/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * com_distri_compras_alta.java
 *
 * Created on 20/02/2012, 03:47:17 PM
 */

package sie_invdis;



import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.*;
import java.text.ParseException;
/**
 *
 * @author Michelle
 */
public class com_distri_compras_alta extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo_detallecompra;
    private javax.swing.table.DefaultTableModel jtable_modelo_detalledistribucion;
    private javax.swing.table.DefaultTableModel jtable_modelo_detalledistri_interno;
    private javax.swing.table.DefaultTableModel jtable_modelo_detalledistri_intupdate;
    private javax.swing.table.DefaultTableModel jtable_modelo_detalledistri_ingresa;
    private javax.swing.table.DefaultTableModel jtable_modelo_etiqueta;
    private javax.swing.table.DefaultTableModel jtable_modelo_terminaciones;
    private javax.swing.table.DefaultTableModel jtable_modelo;
    private DefaultListModel modelo ;
    private bd_conexion x = new bd_conexion() ;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
       //se creaa la variable resultset
    private ResultSet rs = null;
    int controlcombo=0,controlpro=0,sihaytotal=0,controlcargo=0,elementosmodelo=0,indicetermina=0,hayregistros=0,yacarguedistrirecepciones=0,indexactual=0;
    /** Creates new form com_distri_compras_alta */
    public com_distri_compras_alta() {
         this.iniciar_modelo_de_tabla();
        this.iniciar_modelo_distribucionalma();
        this.iniciar_modelo_distribucion_controlinterno();
        this.iniciar_modelo_distribucion_ingresa();
        this.iniciar_modelo_detetiqueta();
        this.iniciar_modelo_distribucion_controlintupdate();
        this.iniciar_modelo_terminacionescodigo();
        this.iniciar_modelo_recpeciones();
        initComponents();
        java.util.Date fechahoya=new Date();

        this.jdc_fechadocto.setDate(fechahoya);
        this.jdc_fecharef.setDate(fechahoya);
        this.jdc_fecharecepcion.setDate(fechahoya);
        this.loadcom_clasifoviajes();
        this.loadcombofamilia();
        this.loadiddescricorta();
        this.loadidmes();
        this.loadidyear();
        //this.loadcomclientes();
        //this.jlbl_mensajeidinsumo.setText("");
        //this.jcmbx_tiendaclie.requestFocus();
        this.carga_datos_claveterminaciontabla(2,this.jtf_idproveedor.getText().toUpperCase());
        jtb_terminadosentrada.getColumnModel().getColumn(0).setPreferredWidth(5);//id
        jtb_terminadosentrada.getColumnModel().getColumn(1).setPreferredWidth(60);//Codigo
        jtb_terminadosentrada.getColumnModel().getColumn(2).setPreferredWidth(120);//Descripcion
        jtb_terminadosentrada.getColumnModel().getColumn(3).setPreferredWidth(80);//Desc corta
        jtb_terminadosentrada.getColumnModel().getColumn(4).setPreferredWidth(60);//Item
        jtb_terminadosentrada.getColumnModel().getColumn(5).setPreferredWidth(60);//item michelle
        jtb_terminadosentrada.getColumnModel().getColumn(6).setPreferredWidth(5);//Unidad
        jtb_terminadosentrada.getColumnModel().getColumn(7).setPreferredWidth(10);//Cantidad
        jtb_terminadosentrada.getColumnModel().getColumn(8).setPreferredWidth(15);//costo.
        jtb_terminadosentrada.getColumnModel().getColumn(9).setPreferredWidth(15);//Precio
        jtb_terminadosentrada.getColumnModel().getColumn(10).setPreferredWidth(5);//% desc
        jtb_terminadosentrada.getColumnModel().getColumn(11).setPreferredWidth(5);//% impuesto
        jtb_terminadosentrada.getColumnModel().getColumn(12).setPreferredWidth(30);//Importe
        jtb_terminadosentrada.getColumnModel().getColumn(13).setPreferredWidth(5);//observacion
        jtb_terminadosentrada.getColumnModel().getColumn(14).setPreferredWidth(5);//familia.
        jtb_terminadosentrada.getColumnModel().getColumn(15).setPreferredWidth(15);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(16).setPreferredWidth(5);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(17).setPreferredWidth(5);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(18).setPreferredWidth(5);//sku..
        this.jlst_clientesdistribucion.setSelectedIndex(0);
        this.jtf_tiendaactual.setText(this.jlst_clientesdistribucion.getSelectedValue().toString());
        this.jcmbx_clasifviaje.requestFocus();
        controlcargo=1;
        
        jtb_distribucionalta.getColumnModel().getColumn(0).setPreferredWidth(10);//status
        jtb_distribucionalta.getColumnModel().getColumn(1).setPreferredWidth(40);//Folio
        jtb_distribucionalta.getColumnModel().getColumn(2).setPreferredWidth(60);//fecha
        jtb_distribucionalta.getColumnModel().getColumn(3).setPreferredWidth(25);//fecha llega tienda


        

    }
    public com_distri_compras_alta(int opcion,String folio) {
         this.iniciar_modelo_de_tabla();
        this.iniciar_modelo_distribucionalma();
        this.iniciar_modelo_distribucion_controlinterno();
        this.iniciar_modelo_distribucion_ingresa();
        this.iniciar_modelo_detetiqueta();
        this.iniciar_modelo_distribucion_controlintupdate();
        this.iniciar_modelo_terminacionescodigo();
        this.iniciar_modelo_recpeciones();
        initComponents();
        java.util.Date fechahoya=new Date();

        this.jdc_fechadocto.setDate(fechahoya);
        this.jdc_fecharef.setDate(fechahoya);
        this.jdc_fecharecepcion.setDate(fechahoya);
         this.carga_datos_claveterminaciontabla(2,this.jtf_idproveedor.getText().toUpperCase());
        if(opcion==1)
        {
            this.carga_datos_encabezado(11, folio);
            this.carga_datos_detalle(folio);
            this.carga_datos_distribucionalma(folio);
            this.carga_datos_proveedor(1, this.jtf_idproveedor.getText().toUpperCase().trim());
            this.contruir_totales_distribucionalma();
        }
        this.loadcom_clasifoviajes2();
        this.loadcombofamilia();
        this.loadiddescricorta();
        this.loadidmes();
        this.loadidyear();
        //this.loadcomclientes();
        //this.jlbl_mensajeidinsumo.setText("");
        //this.jcmbx_tiendaclie.requestFocus();

        jtb_terminadosentrada.getColumnModel().getColumn(0).setPreferredWidth(5);//id
        jtb_terminadosentrada.getColumnModel().getColumn(1).setPreferredWidth(60);//Codigo
        jtb_terminadosentrada.getColumnModel().getColumn(2).setPreferredWidth(120);//Descripcion
        jtb_terminadosentrada.getColumnModel().getColumn(3).setPreferredWidth(80);//Desc corta
        jtb_terminadosentrada.getColumnModel().getColumn(4).setPreferredWidth(60);//Item
        jtb_terminadosentrada.getColumnModel().getColumn(5).setPreferredWidth(60);//item michelle
        jtb_terminadosentrada.getColumnModel().getColumn(6).setPreferredWidth(5);//Unidad
        jtb_terminadosentrada.getColumnModel().getColumn(7).setPreferredWidth(10);//Cantidad
        jtb_terminadosentrada.getColumnModel().getColumn(8).setPreferredWidth(15);//costo.
        jtb_terminadosentrada.getColumnModel().getColumn(9).setPreferredWidth(15);//Precio
        jtb_terminadosentrada.getColumnModel().getColumn(10).setPreferredWidth(5);//% desc
        jtb_terminadosentrada.getColumnModel().getColumn(11).setPreferredWidth(5);//% impuesto
        jtb_terminadosentrada.getColumnModel().getColumn(12).setPreferredWidth(30);//Importe
        jtb_terminadosentrada.getColumnModel().getColumn(13).setPreferredWidth(5);//observacion
        jtb_terminadosentrada.getColumnModel().getColumn(14).setPreferredWidth(5);//familia.
        jtb_terminadosentrada.getColumnModel().getColumn(15).setPreferredWidth(15);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(16).setPreferredWidth(5);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(17).setPreferredWidth(5);//sku..
        jtb_terminadosentrada.getColumnModel().getColumn(18).setPreferredWidth(5);//sku..
        this.jlst_clientesdistribucion.setSelectedIndex(0);
        this.jtf_tiendaactual.setText(this.jlst_clientesdistribucion.getSelectedValue().toString());
        this.jcmbx_clasifviaje.requestFocus();
        controlcargo=1;

        jtb_distribucionalta.getColumnModel().getColumn(0).setPreferredWidth(10);//status
        jtb_distribucionalta.getColumnModel().getColumn(1).setPreferredWidth(40);//Folio
        jtb_distribucionalta.getColumnModel().getColumn(2).setPreferredWidth(60);//fecha
        jtb_distribucionalta.getColumnModel().getColumn(3).setPreferredWidth(25);//fecha llega tienda


   
       
        this.carga_datos_claveterminacionlocal(1,"");
    }

private void iniciar_modelo_de_tabla()
    {
        jtable_modelo_detallecompra=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detallecompra.addColumn("<html><b>Id</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Desc Corta</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Item Prov</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Item michelle.</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Un</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Cant</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>% Desc.</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>% Impu.</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Importe</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>Observacion</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>F</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>sku</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>C.V</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>d</b></html>");
        jtable_modelo_detallecompra.addColumn("<html><b>r</b></html>");
    }
private void iniciar_modelo_distribucionalma()
    {
        modelo = new javax.swing.DefaultListModel();
        jtable_modelo_detalledistribucion=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detalledistribucion.addColumn("Codigo");
        jtable_modelo_detalledistribucion.addColumn("Item");
        jtable_modelo_detalledistribucion.addColumn("Costo");
        jtable_modelo_detalledistribucion.addColumn("P.Michelle");
        try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_distribucion_clientes_activos() as (id smallint,idcleinte character varying(12),ordenvisua smallint,clientenombre character varying(60),orden smallint);",variables_global.getconexiongral());
               while (rs.next())
                    {
                          jtable_modelo_detalledistribucion.addColumn("<html><b>"+rs.getString("idcleinte")+":"+rs.getString("clientenombre")+"</b></html>");
                          System.out.println("modelo");
                          modelo.addElement(rs.getString("idcleinte")+":"+rs.getString("clientenombre"));
                          elementosmodelo+=1;
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
        jtable_modelo_detalledistribucion.addColumn("Total");
    }

private void iniciar_modelo_distribucion_controlinterno()
    {
        jtable_modelo_detalledistri_interno=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Folio Ref</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo_detalledistri_interno.addColumn("<html><b>prov</b></html>");
    }

private void iniciar_modelo_distribucion_controlintupdate()
    {
        jtable_modelo_detalledistri_intupdate=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Costo</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Folio Ref</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo_detalledistri_intupdate.addColumn("<html><b>prov</b></html>");
    }

private void iniciar_modelo_distribucion_ingresa()
    {
        jtable_modelo_detalledistri_ingresa=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_detalledistri_ingresa.addColumn("<html><b>Id tienda</b></html>");
        jtable_modelo_detalledistri_ingresa.addColumn("<html><b>Tienda</b></html>");
        jtable_modelo_detalledistri_ingresa.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_detalledistri_ingresa.addColumn("<html><b>Cantidad</b></html>");
  }

private void iniciar_modelo_detetiqueta()
    {
        jtable_modelo_etiqueta=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_etiqueta.addColumn("<html><b>Clave</b></html>");
        jtable_modelo_etiqueta.addColumn("<html><b>Descripcion</b></html>");
        jtable_modelo_etiqueta.addColumn("<html><b>Precio</b></html>");
        jtable_modelo_etiqueta.addColumn("<html><b>Cantidad</b></html>");
        jtable_modelo_etiqueta.addColumn("<html><b>Item</b></html>");
        
    }

private void iniciar_modelo_terminacionescodigo()
    {
        jtable_modelo_terminaciones=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_terminaciones.addColumn("<html><b>id</b></html>");
        jtable_modelo_terminaciones.addColumn("<html><b>Terminacion</b></html>");
        jtable_modelo_terminaciones.addColumn("<html><b>Codigo</b></html>");
    }

private void iniciar_modelo_recpeciones()
    {

        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Folio</b></html>");
        jtable_modelo.addColumn("<html><b>Status</b></html>");
        jtable_modelo.addColumn("<html><b>Cliente</b></html>");
        jtable_modelo.addColumn("<html><b>Doc. Ant.</b></html>");
        jtable_modelo.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo.addColumn("<html><b>F.llega Tienda</b></html>");
        jtable_modelo.addColumn("<html><b>F.Recepcion</b></html>");
        jtable_modelo.addColumn("<html><b>Dias Trans.</b></html>");
        jtable_modelo.addColumn("<html><b>Guia Env.</b></html>");
        jtable_modelo.addColumn("<html><b>Piezas</b></html>");
        jtable_modelo.addColumn("<html><b>Costo</b></html>");
        jtable_modelo.addColumn("<html><b>Observaciones</b></html>");


   }


private void loadcom_clasifoviajes()
    {
            this.jcmbx_clasifviaje.removeAllItems();
            this.jcmbx_clasifviaje.addItem("0"+"::"+"ELEGIR Viaje");
            String texto="select * from x1distribucion_terminados_viajes(2,0,'') as (id integer,describe character varying(30),idinicialclave character varying(3));";
             System.out.println(texto);
            try
            {
                rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_clasifviaje.addItem(rs.getString("id")+":"+rs.getString("idinicialclave")+":"+rs.getString("describe"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }

    }
private void loadcom_clasifoviajes2()
    {

            String texto="select * from x1distribucion_terminados_viajes(2,0,'') as (id integer,describe character varying(30),idinicialclave character varying(3));";
             System.out.println(texto);
            try
            {
                rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcmbx_clasifviaje.addItem(rs.getString("id")+":"+rs.getString("idinicialclave")+":"+rs.getString("describe"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }

    }
private void loadcombofamilia()
 {
            try
            {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_articulo_familia() as (id character varying(5),describe character varying(40));",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcbx_familia.addItem(rs.getString("id")+":"+rs.getString("describe"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }

private void loadiddescricorta()
 {
            try
            {
                rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_articulo_descricorta(1,'','') as (id character varying(3),describe character varying(40),observaa text);",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcbx_iddescricorta.addItem(rs.getString("id")+":"+rs.getString("describe"));
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }

private void loadidmes()
 {
                    this.jcbx_clavemes.addItem("A:Enero");
                    this.jcbx_clavemes.addItem("B:Febrero");
                    this.jcbx_clavemes.addItem("C:Marzo");
                    this.jcbx_clavemes.addItem("D:Abril");
                    this.jcbx_clavemes.addItem("E:Mayo");
                    this.jcbx_clavemes.addItem("F:Junio");
                    this.jcbx_clavemes.addItem("G:Julio");
                    this.jcbx_clavemes.addItem("H:Agosto");
                    this.jcbx_clavemes.addItem("I:Septiembre");
                    this.jcbx_clavemes.addItem("J:Octubre");
                    this.jcbx_clavemes.addItem("L:Noviembre");
                    this.jcbx_clavemes.addItem("M:Deciembre");

    }

private void loadidyear()
 {
                    this.jcbx_claveyear.addItem("E:2012");
                    this.jcbx_claveyear.addItem("F:2013");
                    this.jcbx_claveyear.addItem("G:2014");
                    this.jcbx_claveyear.addItem("H:2015");
                    this.jcbx_claveyear.addItem("I:2016");


    }

private int findcolumna_idtienda (String titulo)  {
  int columnas = jtable_modelo_detalledistribucion.getColumnCount(),columencontrado=0;
  String columtitulo[]=null;
      for(int j = 0 ;j < columnas ; j++)
                {
                    columtitulo= jtable_modelo_detalledistribucion.getColumnName(j).replace("<html><b>","").split(":");
                    if(columtitulo[0].equals(titulo))
                        {
                            columencontrado=j;
                        }
                }
    return columencontrado;
}
private String findcolumna_destienda (String titulo)  {
  int columnas = jtable_modelo_detalledistribucion.getColumnCount(),columencontrado=0;
  String columtitulo[]=null,tienda="";
      for(int j = 0 ;j < columnas ; j++)
                {
                    columtitulo= jtable_modelo_detalledistribucion.getColumnName(j).replace("<html><b>","").split(":");
                    if(columtitulo[0].equals(titulo))
                        {
                            tienda=columtitulo[1];
                        }
                }
    return tienda.replace("</b></html>","");
}
private void crea_hoja_actualizacosto(String arreglof,String costo,int columna)
    {
        DecimalFormat miformat = new DecimalFormat("#########.##");
        int numerofilasd=this.jtable_modelo_detallecompra.getRowCount(),numerofilasdi=this.jtable_modelo_detalledistribucion.getRowCount(),numerofilasdici=this.jtable_modelo_detalledistri_interno.getRowCount();
        
        String idstat="",idclista="",idclientemodelo[]=null;
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=00,encontrado=0,nclie=0,folioref=0;
        Object[] fnewRow = new Object[numerocolumnas],fnewRowdet = new Object[17];
        float cantiant=0;
       //reviso en la tabla de detalle si ya existe para solo aumentar la cantidad
        for( ii=0;ii<numerofilasd;ii++)
                {
                    idstat=jtable_modelo_detallecompra.getValueAt(ii, 1).toString();
                    if (idstat.equals(arreglof.trim().toUpperCase()))
                        {
                            encontrado=1;
                            jtable_modelo_detallecompra.setValueAt(costo,ii ,8);
                        }
                }
        //si ya existe significa que tambien existe ne distribucion y controlinterno de distribucion
        if(encontrado==1)
            {
                //actualiso la Distribucion
                for( ii=0;ii<numerofilasdi;ii++)
                {
                    idstat=jtable_modelo_detalledistribucion.getValueAt(ii, 0).toString();
                    if (idstat.equals(arreglof.trim().toUpperCase()))
                        {
                            jtable_modelo_detalledistribucion.setValueAt(costo,ii,2);
                        }
                }
                //actualizo distribucion de Control Interno
                for( ii=0;ii<numerofilasdici;ii++)
                {
                    idstat=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                    if (idstat.equals(arreglof.trim().toUpperCase()))
                        {
                            jtable_modelo_detalledistri_interno.setValueAt(costo,ii,3);
                        }
                }
            }
   
    }
private void contruir_totales_distribucionalma()
    {
         Object[] fnewRow = new Object[3];
         DecimalFormat myFormatter = new DecimalFormat("###,###,###");
         float totalve=0,totgeneral=0,totalimporte=0;
         //int totalfilasreporte=this.jtable_modelo_detalledistribucion.getRowCount()-1,i=0,ii=0;
         int totalfilasreporte=this.jtable_modelo_detalledistribucion.getRowCount(),i=0,ii=0;
         int numerotiendas=this.jtable_modelo_detalledistribucion.getColumnCount()-5;
         //genero los totales por tienda
         System.out.println("sali de Eliminar:"+i);
            fnewRow[0]="Total Piezas:";
            this.jtable_modelo_detalledistribucion.addRow(fnewRow);
            sihaytotal=1;
            totalfilasreporte=this.jtable_modelo_detalledistribucion.getRowCount()-1;
         for( ii=0;ii<numerotiendas;ii++)
            {
             totalve=0;
             totalimporte=0;
                for(i=0;i<totalfilasreporte;i++)
                    {
                        totalve+=Float.valueOf(jtable_modelo_detalledistribucion.getValueAt(i, ii+4).toString().replace(",","").replace(".","").replace("<html><h3><b>", "").replace("</b></h3></html>", ""));
                    }
                    jtable_modelo_detalledistribucion.setValueAt("<html><h3><b>"+myFormatter.format(totalve)+"</b></h3></html>",i,ii+4);
                    totgeneral+=totalve;
            }
           totalve=0;
           for(i=0;i<totalfilasreporte;i++)
                  {
                        totalve=0;
                        for( ii=0;ii<numerotiendas;ii++)
                            {
                                totalve+=Float.valueOf(jtable_modelo_detalledistribucion.getValueAt(i, ii+4).toString().replace(",","").replace(".","").replace("<html><h3><b>", "").replace("</b></h3></html>", ""));
                            }
                        jtable_modelo_detalledistribucion.setValueAt("<html><h3><b>"+myFormatter.format(totalve)+"</b></h3></html>",i,ii+4);
                  }
         
     }
private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jtf_tiendaactual.setText(this.jlst_clientesdistribucion.getSelectedValue().toString());
    }
private void dioclickdis(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        int totalfilasreporte=this.jtable_modelo_detalledistri_interno.getRowCount(),i=0,ii=0;
        int fila =jtb_distribucion.getSelectedRow();
        float piezas=0;
        String codigo = jtb_distribucion.getValueAt(fila, 0).toString(),codigoint="";
        while(jtable_modelo_detalledistri_intupdate.getRowCount()>0)jtable_modelo_detalledistri_intupdate.removeRow(0);
         for( ii=0;ii<totalfilasreporte;ii++)
                            {
                                codigoint=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                                if(codigo.equals(codigoint))
                                    {
                                        piezas+=Float.valueOf(this.jtable_modelo_detalledistri_interno.getValueAt(ii, 2).toString());
                                        this.jtable_modelo_detalledistri_intupdate.addRow(new Object[]{this.jtable_modelo_detalledistri_interno.getValueAt(ii, 0).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 2).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 3).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 4).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 5).toString(),this.jtable_modelo_detalledistri_interno.getValueAt(ii, 6).toString()});
                                    }
                            }
         this.jtf_piezasxparupdate.setText(String.valueOf(piezas));
         this.jtf_actualizadisclave.setText(codigo);
    }
 private void dioclickgenven(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
            System.out.println("dio doble  click en subfamilia");
            int fila = jtbl_recepciones.getSelectedRow(),folio=Integer.valueOf(this.jtable_modelo.getValueAt(fila, 0).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "").replace("<font></b></html>","").replace("</html>", "")),piezas=Integer.valueOf(this.jtable_modelo.getValueAt(fila, 9).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "").replace("<font></b></html>","").replace("</html>", ""));
            String cliente[]=this.jtable_modelo.getValueAt(fila, 2).toString().split(":");
            //if ((folio==0) && (piezas>0))
            this.jtf_idffila.setText(String.valueOf(fila));
            if (folio==0)
                {
                    this.jtf_idcliente.setText(cliente[0]);
                    this.jtf_describecliente.setText(cliente[1]);
                    this.jtf_pzasdistri.setText(String.valueOf(piezas));
                    this.jtf_idcliente.setVisible(true);
                    this.jtf_describecliente.setVisible(true);
                    this.jtf_pzasdistri.setVisible(true);
                    this.jbtn_generarventa.setVisible(true);
                }
            else
                {
                    this.jtf_idcliente.setVisible(false);
                    this.jtf_describecliente.setVisible(false);
                    this.jtf_pzasdistri.setVisible(false);
                    this.jbtn_generarventa.setVisible(false);
                }

    }

private void documento_guardar(int opciongeneral,int opcion)
    {
        ResultSet rs = null;
        float cantidad=0;
        int nobjetotabla=this.jtb_terminadosentrada.getRowCount();
        int fi=0,controlfolio=0;
        String cadenafilas="{'", arreglo_articulos[]=null;
        if(JOptionPane.showConfirmDialog(null, "<html><h2>Documento:"+this.tf_foliodoctoanterior.getText()+"<br>Viaje :"+this.jcmbx_clasifviaje.getSelectedItem()+"<br> Piezas:"+this.jtf_cantidadpiezas.getText()+"<br>Costo Factura:"+this.jtf_doctototal.getText()+"<br> Precio Distribucion:"+this.jtf_totalcostov.getText()+"<br>sera Guardado. Estan correcto sus Datos?</h2></html>")==0)
                    {
                    //this.quitardescripcion();
                    java.util.Vector arreglodearticulos=this.jtable_modelo_detallecompra.getDataVector();
                    String articulos_papostgresql=arreglodearticulos.toString();
                    articulos_papostgresql=articulos_papostgresql.replace('[','{');
                    articulos_papostgresql=articulos_papostgresql.replace(']','}');
                    articulos_papostgresql=articulos_papostgresql.replace("null",".");

                    java.util.Vector arreglodeart_dis=this.jtable_modelo_detalledistri_interno.getDataVector();
                    String articulos_papostgresqld=arreglodeart_dis.toString();
                    articulos_papostgresqld=articulos_papostgresqld.replace('[','{');
                    articulos_papostgresqld=articulos_papostgresqld.replace(']','}');
                    articulos_papostgresqld=articulos_papostgresqld.replace("null",".");

                    String arreglo_viaje[]=this.jcmbx_clasifviaje.getSelectedItem().toString().split(":");
                    String texto="select * from x1distribucion_terminados_entra_doctos_insertv5("+opciongeneral+","+opcion+",'','"+this.tf_foliodoctoanterior.getText().toUpperCase()+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','"+this.fechaamericana(this.jdc_fecharef.getDate())+"','"+this.fechaamericana(this.jdc_fecharecepcion.getDate())+"',"+Float.valueOf(this.jtf_descuento.getText().trim())+","+Float.valueOf(this.jtf_impuesto.getText().trim())+",'"+this.jtf_idproveedor.getText().toUpperCase()+"','"+this.jep_observaciones.getText().toUpperCase().replace(",", "").replace("]", "").replace("[", "").replace("{", "").replace("}", "")+"','"+variables_global.getLogin()+"','"+arreglo_viaje[0]+"','"+articulos_papostgresql+"','"+articulos_papostgresqld+"','"+this.jtf_cantidadpiezas.getText()+"','"+this.jtf_doctodesc.getText()+"','"+this.jtf_doctoimp.getText()+"','"+this.jtf_doctosubtotal.getText()+"','"+this.jtf_doctototal.getText()+"','"+this.jtf_totalcostov.getText()+"','"+this.jtf_fleteygastos.getText()+"',"+this.jtf_idfolio.getText()+",'"+this.jtf_totalpreciopublic.getText()+"')";
                    System.out.println(texto);
                    try
                        {
                        rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                            {
                            if (rs.getInt(1) > 0)
                                    {
                                        JOptionPane.showMessageDialog(null,"Documento "+rs.getInt(1)+" Correcto, Gracias", "Sistema Integral(Alta Compra) : Confirmacion",1);
                                        this.jtf_idfolio.setText(rs.getString(1));
                                        //this.Limpiar_compra();
                                    }
                                else
                                    {
                                        JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(Alta Compra) : Error",1);
                                    }
                            }
                        }
                    catch(Exception e) {
                        System.out.println(e.getMessage());
                        JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Alta Compra) : Error",1);
                    }
                }//fin del if qu confirmo guardar diferencia
    }

private void documento_guardar_mas(int opcion)
    {
        ResultSet rs = null;
        float cantidad=0;
        int nobjetotabla=this.jtb_terminadosentrada.getRowCount();
        int fi=0,controlfolio=0;
        String cadenafilas="{'", arreglo_articulos[]=null;
        if(JOptionPane.showConfirmDialog(null, "Documento sera Guardado. Estan correcto sus Datos?")==0)
                    {
                    //this.quitardescripcion();
                    java.util.Vector arreglodearticulos=this.jtable_modelo_detallecompra.getDataVector();
                    String articulos_papostgresql=arreglodearticulos.toString();
                    articulos_papostgresql=articulos_papostgresql.replace('[','{');
                    articulos_papostgresql=articulos_papostgresql.replace(']','}');
                    articulos_papostgresql=articulos_papostgresql.replace("null",".");

                    java.util.Vector arreglodeart_dis=this.jtable_modelo_detalledistri_interno.getDataVector();
                    String articulos_papostgresqld=arreglodeart_dis.toString();
                    articulos_papostgresqld=articulos_papostgresqld.replace('[','{');
                    articulos_papostgresqld=articulos_papostgresqld.replace(']','}');
                    articulos_papostgresqld=articulos_papostgresqld.replace("null",".");

                    String arreglo_viaje[]=this.jcmbx_clasifviaje.getSelectedItem().toString().split(":");
                    String texto="select * from x1distribucion_terminados_entra_doctos_insert_mas("+opcion+",'','"+this.tf_foliodoctoanterior.getText().toUpperCase()+"','"+this.fechaamericana(this.jdc_fechadocto.getDate())+"','"+this.fechaamericana(this.jdc_fecharef.getDate())+"','"+this.fechaamericana(this.jdc_fecharecepcion.getDate())+"',"+Float.valueOf(this.jtf_descuento.getText().trim())+","+Float.valueOf(this.jtf_impuesto.getText().trim())+",'"+this.jtf_idproveedor.getText().toUpperCase()+"','"+this.jep_observaciones.getText().toUpperCase().replace(",", "").replace("]", "").replace("[", "").replace("{", "").replace("}", "")+"','"+variables_global.getLogin()+"','"+arreglo_viaje[0]+"','"+articulos_papostgresql+"','"+articulos_papostgresqld+"')";
                    System.out.println(texto);
                    try {
                        rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                        {
                            if (rs.getInt(1) > 0)
                                    {
                                        JOptionPane.showMessageDialog(null,"Documento "+rs.getInt(1)+" Correcto, Gracias", "Sistema Integral(Alta Compra) : Confirmacion",1);
                                        this.jtf_idfolio.setText(rs.getString(1));
                                        //this.Limpiar_compra();
                                    }
                                else
                                    {
                                        JOptionPane.showMessageDialog(null," Error Verifique sus Cantidades", "Sistema Integral(Alta Compra) : Error",1);
                                    }
                        }
                    } catch(Exception e) {
                        System.out.println(e.getMessage());
                        JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Alta Compra) : Error",1);
                    }
                }//fin del if qu confirmo guardar diferencia
    }

private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;
    }

private String fechaamericana(String fecha) {

         //resibe cadena de fecha en formato americano dd-MM-yyyy
       java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaamericano = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateador.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaamericano.format(fechaestaeuropa);
       return cadenafecha;

    }

private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;
    }

 private void calcularimportes()
    {
     DecimalFormat miforma = new DecimalFormat("###,###,###,###,###.##");
     DecimalFormat miforma2 = new DecimalFormat("###############.##");
     int numerofilas=this.jtable_modelo_detallecompra.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    double cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0,doctoimpuestop=0,importecostov=0,cd=0,cod=0,cdi=0;
    double canr=0,importefilar=0,descuentor=0,impuestor=0,doctosubtotalr=0,doctoimpuestor=0,doctodescuentor=0,doctototalr=0,doctoimpuestopr=0,ppublic=0;
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 7).toString()).floatValue();
                            piezasindi+=cantidad;
                            cd= Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 17).toString()).floatValue();
                            cdi+=cd;
                            canr=cantidad+(cd*-1);
                            costo = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 8).toString()).floatValue();
                            ppublic+=Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 8).toString()).floatValue()*cantidad;
                            
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 10).toString())/100);
                            //real
                            descuentor=(costo*canr)*(Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 10).toString())/100);

                            importefila=(cantidad*costo);
                            //real
                            importefilar=(canr*costo);
                            
                            //System.out.println(descuento);
                            impuesto=(importefila-descuento)*Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 11).toString())/100;
                            //real
                            impuestor=(importefilar-descuentor)*Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 11).toString())/100;

                            importecostov+=canr*Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 16).toString()).floatValue();

                            cod+=cd*costo;
                            //System.out.println(descuento+":"+impuesto);
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;
                            doctoimpuestop+=impuesto;
                            //real
                            doctodescuentor+=descuentor;
                            doctosubtotalr+=importefilar;
                            doctoimpuestopr+=impuestor;
                        }
                        catch (NumberFormatException nfe)
                        {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      jtable_modelo_detallecompra.setValueAt(importefila,i,12);
                }
    //doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuestop;
    //real
    doctototalr=(doctosubtotalr-doctodescuentor)+doctoimpuestopr;

    this.jtf_cantidadpiezas.setText(miforma2.format(piezasindi));
    this.jtf_doctosubtotal.setText(miforma2.format(doctosubtotal));
    this.jtf_doctodesc.setText(miforma2.format(doctodescuento));
    this.jtf_doctoimp.setText(miforma2.format(doctoimpuestop));
    this.jtf_doctototal.setText(miforma2.format(doctototal));

    this.jtf_totalcostov.setText(miforma2.format(importecostov));
    this.jtf_totalpreciopublic.setText(miforma2.format(ppublic));
    this.jtf_cantidadpiezas1.setText(miforma2.format(cdi));
    this.jtf_cantidadpiezas2.setText(miforma.format(cod));
    //this.jtf_fleteygastos1.setText(doctoimpuestop-doctodescuento);
    this.jtf_doctosubtotal1.setText(miforma2.format(doctosubtotalr));
    this.jtf_doctodesc1.setText(miforma2.format(doctodescuentor));
    this.jtf_doctoimp1.setText(miforma2.format(doctoimpuestopr));
    this.jtf_doctototal1.setText(miforma2.format(doctototalr));


    }
 private void calcular_costoi()
 {
                DecimalFormat miformatim = new DecimalFormat("############.####");
                double costoa=Float.valueOf(this.jtf_fleteygastos.getText().toString())+(Float.valueOf(this.jtf_doctoimp1.getText().toString())-Float.valueOf(this.jtf_doctodesc1.getText().toString()));
                this.jtf_fleteygastos1.setText(miformatim.format(costoa));
                double cantidadi = 1+(costoa/Float.valueOf(this.jtf_doctosubtotal1.getText().toString())),costo=0;
                int i=0,ii=0;
                if(cantidadi>0)
                this.jtf_fleteygastospor.setText(miformatim.format(cantidadi));
                else
                this.jtf_fleteygastospor.setText("0");
                String cod="",cod2="";
                for( i = 0 ;i < this.jtable_modelo_detallecompra.getRowCount(); i++)
                {
                            try
                                    {
                                        costo = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 8).toString()).floatValue();
                                        if(costo>0)
                                        jtable_modelo_detallecompra.setValueAt(miformatim.format(costo*cantidadi),i,16);
                                        else
                                        jtable_modelo_detallecompra.setValueAt("0",i,16);
                                    }
                                catch (NumberFormatException nfe)
                                    {

                                    }
                                    cod2=jtable_modelo_detallecompra.getValueAt(i, 1).toString();
                                    for( ii=0;ii<this.jtable_modelo_detalledistri_interno.getRowCount();ii++)
                                            {

                                                cod=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();

                                                if (cod.equals(cod2))
                                                        {
                                                            System.out.println("codigo interno:"+cod2+" y"+ cod);
                                                            jtable_modelo_detalledistri_interno.setValueAt(miformatim.format(costo*cantidadi),ii,4);
                                                        }
                                                }
                }
                this.calcularimportes();
//                this.calcular_costoi();
 }

 private void calcularimportes_red()
    {
     DecimalFormat miforma = new DecimalFormat("#########");
     DecimalFormat miforma2 = new DecimalFormat("#########.##");
     int numerofilas=this.jtable_modelo_detallecompra.getRowCount(),error=0;
     String punto="",comas="",imagen="";
     float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctoimpuestop=0,piezasindi=0,doctototal;;
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 7).toString()).floatValue();
                            costo = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 8).toString()).floatValue();
                            piezasindi+=cantidad;
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 10).toString())/100);
                            //System.out.println(descuento);
                            importefila=(cantidad*costo);
                            impuesto=(importefila-descuento)*Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 11).toString())/100;
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;
                            doctoimpuestop+=impuesto;
                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      jtable_modelo_detallecompra.setValueAt(miforma2.format((importefila-descuento)/cantidad),i,11);
                      jtable_modelo_detallecompra.setValueAt(miforma.format(importefila-descuento),i,12);
                }
    doctosubtotal=0;
    for(int i = 0 ;i < numerofilas; i++)
                {
                doctosubtotal+=Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 12).toString()).floatValue();
                //jtable_modelo_detallecompra.setValueAt(miforma2.format(Float.valueOf(this.jtable_modelo_detallecompra.getValueAt(i, 12).toString()).floatValue()/Float.valueOf(this.jtable_modelo_detallecompra.getValueAt(i, 7).toString()).floatValue()),i,8);
                }

    //doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuestop;
    this.jtf_doctosubtotal.setText(miforma.format(doctosubtotal));
    this.jtf_doctodesc.setText(miforma.format(doctodescuento));
    this.jtf_doctoimp.setText(miforma.format(doctoimpuestop));
    this.jtf_doctototal.setText(miforma.format(doctosubtotal));
    this.jtf_cantidadpiezas.setText(miforma2.format(piezasindi));
    }
 private void calcularimportes_redsim()
    {
    DecimalFormat miforma = new DecimalFormat("#########");
    int numerofilas=this.jtable_modelo_detallecompra.getRowCount(),error=0;
    String punto="",comas="",imagen="";
    float cantidad=0,costo=0,importefila=0,descuento=0,impuesto=0,doctosubtotal=0,doctoimpuesto=0,doctodescuento=0,doctototal=0,piezasindi=0;
     for(int i = 0 ;i < numerofilas; i++)
                {
                 try
                       {
                            cantidad = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 7).toString()).floatValue();
                            costo = Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 8).toString()).floatValue();
                            piezasindi+=cantidad;
                            descuento=(costo*cantidad)*(Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 10).toString())/100);
                            //System.out.println(descuento);
                            impuesto=Float.valueOf(this.jtb_terminadosentrada.getValueAt(i, 11).toString())/100;
                            //System.out.println(descuento+":"+impuesto);
                            importefila=(cantidad*costo);
                            doctodescuento+=descuento;
                            doctosubtotal+=importefila;

                        }
                            catch (NumberFormatException nfe) {
                            cantidad=0;
                            costo=0;
                            error=1;
                        }
                      jtable_modelo_detallecompra.setValueAt(miforma.format(importefila-descuento),i,12);
                }
    doctoimpuesto=(doctosubtotal-doctodescuento)*impuesto;
    doctototal=(doctosubtotal-doctodescuento)+doctoimpuesto;
   this.jtf_doctosubtotal.setText(miforma.format(doctosubtotal));
    this.jtf_doctodesc.setText(miforma.format(doctodescuento));
    this.jtf_doctoimp.setText(miforma.format(doctoimpuesto));
    this.jtf_doctototal.setText(miforma.format(doctototal));
    this.jtf_cantidadpiezas.setText(miforma.format(piezasindi));
    }
private void calculardistribucion(int opcion)
    {
        int numerofilas=0,error=0,i=0;
        float cantidad=0;
      switch (opcion)
                    {
                        case 1:
                            numerofilas=this.jtable_modelo_detalledistri_ingresa.getRowCount();
                               for(i = 0 ;i < numerofilas; i++)
                                {
                                 try
                                       {
                                            cantidad += Float.valueOf(this.jtable_modelo_detalledistri_ingresa.getValueAt(i, 2).toString()).floatValue();
                                        }
                                catch (NumberFormatException nfe) {
                                            cantidad=0;
                                           error=1;
                                        }
                                }
                            this.jtf_piezasxparupdate.setText(String.valueOf(cantidad));
                        break;
                        case 2:
                            numerofilas=this.jtable_modelo_detalledistri_intupdate.getRowCount();
                            for(i = 0 ;i < numerofilas; i++)
                                {
                                 try
                                       {
                                            cantidad += Float.valueOf(this.jtable_modelo_detalledistri_intupdate.getValueAt(i, 2).toString()).floatValue();
                                        }
                                catch (NumberFormatException nfe)
                                        {
                                           cantidad=0;
                                           error=1;
                                        }
                                }
                            this.jtf_piezasxparupdate.setText(String.valueOf(cantidad));
                        break;

                    }
     
    }

 private void carga_datos_proveedor(int opcion,String textobusca)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
    int encontro=0;
       try
       {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_proveedores("+opcion+",'"+textobusca+"') as (idpro character varying(12),descripcion character varying(60),direccion character varying(50),colonia character varying(50),poblacion character varying(40),cp character varying(6),rfc character varying(15),curp character varying(20),telefono character varying(30),fax character varying(15),email character varying(50),clasificacion character varying(10),diascredito smallint,limitecredito numeric,descproveedor numeric,fecultventa date,fecultpago date,inicialprovee character varying(20),observa character varying(80),inicialesfinal character varying(3),ctacontrol smallint,subfam smallint,idstatus smallint,acumuladocom numeric,bitacora text,descripclasif character varying(40),obserclasif character varying(30),descripcuenta text,obsercuenta text,describestatus text);",variables_global.getconexiongral());
            while (rs.next())
                {
                        encontro=1;
                        this.jtf_idproveedor.setText(rs.getString("idpro"));
                        this.jtf_describeproveedor.setText(rs.getString("descripcion"));
                        this.jtf_contruirinip.setText(rs.getString("inicialprovee"));
                        this.jtf_clavetc.setText(rs.getString("inicialesfinal"));
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }

if (encontro==1)
    {
        JOptionPane.showMessageDialog(null,"Proveedor: "+textobusca+" Encontrado, Gracias", "Sistema Integral(Alta) : Confirmacion",1);
        this.jep_observaciones.requestFocus();
        controlpro=1;
        this.carga_datos_claveterminacionlocal(2, this.jtf_clavetc.getText().toString());
    }
else
    {
        JOptionPane.showMessageDialog(null," Error Proveedor:"+textobusca+" No Existe", "Sistema Integral(Alta) : Error",1);
        this.jtf_idproveedor.requestFocus();
        controlpro=0;
    }

   }



 private void Limpiar_compra()
    {
        while(jtable_modelo_detallecompra.getRowCount()>0)jtable_modelo_detallecompra.removeRow(0);
        while(jtable_modelo_detalledistribucion.getRowCount()>0)jtable_modelo_detalledistribucion.removeRow(0);
        while(jtable_modelo_detalledistri_interno.getRowCount()>0)jtable_modelo_detalledistri_interno.removeRow(0);
        this.jcmbx_clasifviaje.setSelectedIndex(0);
        controlpro=0;
        this.jtf_descuento.setText("0");
        this.jtf_impuesto.setText("0");
        this.tf_foliodoctoanterior.setText("");
        this.jtf_idproveedor.setText("");
        this.jcmbx_clasifviaje.requestFocus();
    }

private void clave_concatenar(int opcion)
 {
          String arreglo_idfam[]=this.jcbx_familia.getSelectedItem().toString().split(":");
          String arreglo_iddc[]=this.jcbx_iddescricorta.getSelectedItem().toString().split(":");
          String arreglo_idcm[]=this.jcbx_clavemes.getSelectedItem().toString().split(":");
          String arreglo_idcy[]=this.jcbx_claveyear.getSelectedItem().toString().split(":");
          this.jtf_idarticulo.setText(this.jtf_contruirinip.getText().toUpperCase().trim()+arreglo_idfam[0]+arreglo_iddc[0]+arreglo_idcm[0]+arreglo_idcy[0]+this.jtf_claveiv.getText().toUpperCase().trim()+this.jtf_clavetc.getText().toUpperCase().trim());
         switch (opcion) {
            case 1:
                 this.jtf_idarticulo.requestFocus();
                break;
            case 2:
                this.jtf_contruirinip.requestFocus();
                break;
            case 3:
               this.jcbx_familia.requestFocus();
                break;
            case 4:
               this.jcbx_iddescricorta.requestFocus();
                break;
            case 5:
               this.jcbx_clavemes.requestFocus();
               this.jtf_insumodescripcion.setText(arreglo_iddc[1]);
               this.jtf_clavedescor.setText(arreglo_iddc[1]);
                break;
            case 6:
               this.jcbx_claveyear.requestFocus();
                break;
            case 7:
                this.jtf_claveiv.requestFocus();
                break;

        }
         
    }
private int articulo_alta(){
    int confirma=0;

    String arreglo_familia[]=this.jcbx_familia.getSelectedItem().toString().split(":"),texto="";

    texto="select * from x1distribucion_terminados_articulos_alta(1,'','','"+this.jtf_insumodescripcion.getText().trim().toUpperCase()+"','"+this.jtf_clavedescor.getText().trim().toUpperCase()+"','"+this.jtf_itemderi.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"','"+this.jtf_unidadsal.getText().trim().toUpperCase()+"','1','','','','"+arreglo_familia[0]+"','','"+this.jtf_itemprov.getText().trim().toUpperCase()+"','','','"+this.jtf_costo.getText().trim().toUpperCase()+"','"+this.jtf_costo.getText().trim().toUpperCase()+"','"+this.jtf_costo.getText().trim().toUpperCase()+"','"+this.jtf_costo.getText().trim().toUpperCase()+"','"+this.jtf_precioventa.getText().trim().toUpperCase()+"','"+this.jtf_costo.getText().trim()+"','"+this.jtf_costo.getText().trim().toUpperCase()+"','','"+this.jtf_idproveedor.getText().trim().toUpperCase()+"','','','','','"+this.jtf_idarticulo.getText().trim()+"')";
    System.out.println(texto);
    try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                     confirma=rs.getInt(1);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       if (confirma==1)
              {
                JOptionPane.showMessageDialog(null,"Gracias datos Actualizados Correctamente", "Sistema Integral Insumos",1);
              }
         else
              {
                JOptionPane.showMessageDialog(null,"Error Consulte con Su Administrador", "Sistema Integral Insumos",1);
              }
    return confirma;
}
 private void carga_datos_claveterminacion(int opcion,String textobusca,String textobusca2)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
    int encontro=0;
       try
       {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_articulos_terminaclave("+opcion+",'"+textobusca+"','"+textobusca2+"') as (terminacion character varying(3));",variables_global.getconexiongral());
            while (rs.next())
                {
                        encontro=1;
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
   }
 private void carga_datos_claveterminacionlocal(int opcion,String textobusca)
    {
     int numerofilasd=this.jtable_modelo_detallecompra.getRowCount(),caracteres=0,ii=0,numerofilast=this.jtable_modelo_terminaciones.getRowCount(),jj=0;
     String termi="",codigo="",terminaciones="";
     switch (opcion)
                    {
                        case 1:
                                for( ii=0;ii<numerofilasd;ii++)
                                    {
                                        codigo=jtable_modelo_detallecompra.getValueAt(ii, 1).toString();
                                        caracteres=codigo.length();
                                        termi=codigo.substring((caracteres-2), (caracteres));
                                        for( jj=0;jj<numerofilast;jj++)
                                            {
                                                terminaciones=jtable_modelo_terminaciones.getValueAt(jj, 1).toString();
                                                if(termi.equals(terminaciones))
                                                    {
                                                        jtable_modelo_terminaciones.setValueAt(codigo,jj ,2);
                                                        indicetermina=jj;
                                                        jj=numerofilast;
                                                    }
                                            }
                                        //System.out.println("esta es la terminacion"+termi);
                                    }
                        break;
                        case 2:
                                  termi=textobusca;
                                   for( jj=0;jj<numerofilast;jj++)
                                            {
                                                terminaciones=jtable_modelo_terminaciones.getValueAt(jj, 1).toString();
                                                if(termi.equals(terminaciones))
                                                    {
                                                        jtable_modelo_terminaciones.setValueAt(codigo,jj ,2);
                                                        indicetermina=jj;
                                                        jj=numerofilast;
                                                    }
                                                }
                                  if(indicetermina!=0)
                                  {
                                      for( jj=0;jj<indicetermina;jj++)
                                            {
                                                        jtable_modelo_terminaciones.setValueAt("OK",jj ,2);
                                               }
                                      indicetermina=indicetermina-1;
                                  }

                        break;
                    }

   }
 private void carga_datos_claveterminaciontabla(int opcion,String textobusca)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
     Object[] fnewRowf = new Object[3];
    int encontro=0;
       try
       {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_articulos_terminaclave("+opcion+",'"+textobusca+"','') as (id integer,terminacion character varying(4));",variables_global.getconexiongral());
            while (rs.next())
                {
                    fnewRowf[0]=rs.getString("id");
                    fnewRowf[1]=rs.getString("terminacion");
                    fnewRowf[2]=".";
                    jtable_modelo_terminaciones.addRow(fnewRowf);
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
   }
 private void carga_datos_encabezado(int opbus,String tbusca)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="";
        java.util.Date fechaestaeuropa=null;
       DecimalFormat miformat = new DecimalFormat("############.##");
       String texto="select * from x1distribucion_terminados_compras_catalogo("+opbus+",'"+tbusca+"') as (idreg integer,iddocumento character varying(12),idstatus smallint,statusdescribe character varying(15),doctoanterior character varying(12),fechadocto date,fechadoctoenmes text,idproveedor character varying(12),describeproveedor character varying(60),observadocto character varying(80),usuario character varying(20),impuestoporcen numeric,descuentototal numeric,clasificacion smallint,describeclasificacion character varying(30),clasifechainicio date,clasifechafin date,clavepersonaldoc character varying(45),docsiguiente character varying(12),fechaentrega date,fechavenci date,impuestoporcen2 numeric,descuentofinan numeric,piezas numeric,totalimporte numeric,totalprecio numeric,idsubfam smallint,diasenalmacen integer,diasproveealmacen integer,viajeinicla character varying(3),flete numeric);";
       System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                // this.tf_status.setText(rs.getString("idstatus")+":"+rs.getString ("statusdescribe"));
                 this.jcmbx_clasifviaje.addItem(rs.getString("clasificacion")+":"+rs.getString ("describeclasificacion"));
                 this.jtf_idfolio.setText(rs.getString ("iddocumento"));
                 this.tf_foliodoctoanterior.setText(rs.getString ("doctoanterior"));
                 //this.tf_fecha.setText(this.fechaeuropea( rs.getString ("fechadocto"))+":"+DiaSemana(this.fechaeuropea(rs.getString("fechadocto"))));
                  fechaestaeuropa = formateadoresta.parse(rs.getString("fechadocto"));
                  this.jdc_fechadocto.setDate(fechaestaeuropa);
                 if(rs.getString("fechaentrega") != null)
                        {
                           //fechallegatienda=""+ rs.getString("fechaentrega")+":"+DiaSemana(rs.getString ("fechaentrega"))+"";
                            fechaestaeuropa = formateadoresta.parse(rs.getString("fechaentrega"));
                            this.jdc_fecharef.setDate(fechaestaeuropa);
                        }
                 //this.tf_fechareferencia.setText(fechallegatienda);
                 if(rs.getString("fechavenci") != null )
                        {
                            //fechaentrega=""+rs.getString ("fechavenci")+":"+this.DiaSemana(rs.getString("fechavenci"))+"";
                            fechaestaeuropa = formateadoresta.parse(rs.getString("fechavenci"));
                            this.jdc_fecharecepcion.setDate(fechaestaeuropa);
                        }
                 //this.tf_fecharecepcion.setText(fechaentrega);
                 //this.jtf_viaje.setText(rs.getString ("clasificacion")+":"+rs.getString ("describeclasificacion"));
                 this.jcmbx_clasifviaje.addItem(rs.getString ("clasificacion")+"::"+rs.getString ("describeclasificacion"));
                 this.jtf_idproveedor.setText(rs.getString ("idproveedor"));
                 this.jtf_describeproveedor.setText(rs.getString ("describeproveedor"));
                 this.jtf_fleteygastos.setText(miformat.format(rs.getFloat("flete")));
                 //this.jtf_totalpiezas.setText(miformat.format(rs.getFloat("piezas")));
                 //this.jtf_importe.setText(miformat.format(rs.getFloat("totalimporte")));
                 //this.jtf_importeprecio.setText(miformat.format(rs.getFloat("totalprecio")));

                 this.jep_observaciones.setText(rs.getString ("observadocto"));
                 controlpro=1;
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
      }


private void carga_datos_detalle(String tbusca)
    {

       DecimalFormat miformat = new DecimalFormat("############.##");
       DecimalFormat miformatde = new DecimalFormat("############.##");
       int id=0;
       float fle=0;
       Object[] fnewRow = new Object[19];
       Object[] fnewRowd = new Object[this.jtable_modelo_detalledistribucion.getColumnCount()];
       Object[] fnewRowf = new Object[5];
       Object[] fnewRowci = new Object[6];
       while(jtable_modelo_detallecompra.getRowCount()>0)jtable_modelo_detallecompra.removeRow(0);
       while(jtable_modelo_detalledistribucion.getRowCount()>0)jtable_modelo_detalledistribucion.removeRow(0);
       while(jtable_modelo_etiqueta.getRowCount()>0)jtable_modelo_etiqueta.removeRow(0);


       //invoco al metodo que trae el recordset de datos
       String texto ="select * from x1distribucion_terminados_compras_detalle(1,'"+tbusca+"') as (idreg integer,iddocto character varying(12),idarti character varying(16),can_articuloent numeric,factor numeric,cant_articulosal numeric,costoent numeric,costosal numeric,descuento1 numeric,descuento2 numeric,impuesto1 numeric,impuesto2 numeric,politicadescuento smallint,tipocambio numeric,obserparti character varying(60),idartisubmodelo character varying(4),artidescrip character varying(80),unidadsal character varying(3),precio1 numeric,descorta character varying(20),unidadentrada character varying(3),controla character varying(20),itemprovee character varying(20),precio5 numeric,dif numeric,costoi numeric);";
        System.out.println(texto);

        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    ++id;
                    fnewRow[0]=id;
                    fnewRow[1]=rs.getString ("idarti");
                    fnewRow[2]=rs.getString ("artidescrip");
                    fnewRow[3]=rs.getString ("descorta");
                    fnewRow[4]=rs.getString ("itemprovee");
                    fnewRow[5]=rs.getString ("controla");
                    fnewRow[6]=rs.getString ("unidadentrada");
                    fnewRow[7]=miformat.format(rs.getFloat("can_articuloent"));
                    fnewRow[8]=miformatde.format(rs.getFloat("costoent"));
                    fnewRow[9]=miformat.format(rs.getFloat("precio5"));
                    fnewRow[10]=miformatde.format(rs.getFloat("descuento1"));
                    fnewRow[11]=miformatde.format(rs.getFloat("Impuesto1"));
                    fnewRow[12]=miformatde.format(rs.getFloat("can_articuloent")*rs.getFloat("costoent"));
                    fnewRow[13]=rs.getString ("obserparti");
                    fnewRow[14]="F";
                    fnewRow[15]=".";
                    fnewRow[16]=miformatde.format(rs.getFloat("costosal"));
                    fnewRow[17]=miformatde.format(rs.getFloat("dif"));
                    fnewRow[18]="r";
                    jtable_modelo_detallecompra.addRow(fnewRow);
                    fnewRowd[0]=rs.getString ("idarti");
                    fnewRowd[1]=rs.getString ("itemprovee");
                    fnewRowd[2]=miformatde.format(rs.getFloat("costosal"));
                    fnewRowd[3]=miformat.format(rs.getFloat("precio5"));
                    jtable_modelo_detalledistribucion.addRow(fnewRowd);
                    fnewRowf[0]=rs.getString("idarti");
                    fnewRowf[1]=rs.getString("descorta");
                    fnewRowf[2]=miformat.format(rs.getFloat("precio5"));
                    fnewRowf[3]=rs.getString("can_articuloent");
                    fnewRowf[4]=rs.getString("itemprovee");
                    jtable_modelo_etiqueta.addRow(fnewRowf);
                    fle+=(rs.getFloat("can_articuloent")*rs.getFloat("costosal"))-(rs.getFloat("can_articuloent")*rs.getFloat("costoent"));
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
        this.jtf_fleteygastos.setText(miformat.format(fle));
        this.distribucionmaraencero();
        this.calcularimportes();
        this.calcular_costoi();
      }

private void distribucionmaraencero()
    {
        int numerofilas=this.jtable_modelo_detalledistribucion.getRowCount();
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=0,i=0;

        for( i=0;i<numerofilas;i++)
                {
                for( ii=4;ii<numerocolumnas;ii++)
                    {
                        jtable_modelo_detalledistribucion.setValueAt("0",i,ii);
                    }
                }
    }
private void carga_datos_distribucionalma(String idref)
    {
       String fechaeuro="";
       int columnatitulo=0;
       String mespartido="";
   int ncol=this.jtable_modelo_detalledistribucion.getColumnCount();
    while(jtable_modelo_detalledistri_interno.getRowCount()>0)jtable_modelo_detalledistri_interno.removeRow(0);
   DecimalFormat miformat = new DecimalFormat("#########.####");
    Object[] fnewRow = new Object[7];

        try
        {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_articulos_distribucion(2,'"+idref+"',1) as (folio integer,fechamov date,tipomovinve smallint,referenciainve character varying(12),fechareferencia date,clave_clie_prov character varying(16),idarticuloinve character varying(16),cantidadinve numeric,precioinve numeric,costoinve numeric,observainve character varying(80),almacen smallint,folioref smallint,submodelo character varying(4));",variables_global.getconexiongral());
            while (rs.next())
                {
                    mespartido=rs.getString("clave_clie_prov");
                    columnatitulo=this.findcolumna_idtienda(mespartido);
                    this.crea_hoja_distribucionalmacen(rs.getString("idarticuloinve"),rs.getString("cantidadinve").replace("-", ""),columnatitulo,"");
                    fnewRow[0]=rs.getString("clave_clie_prov");
                    fnewRow[1]=rs.getString("idarticuloinve");
                    fnewRow[2]=rs.getString("cantidadinve").replace("-", "");
                    fnewRow[3]=miformat.format(rs.getFloat("costoinve"));
                    fnewRow[4]=miformat.format(rs.getFloat("precioinve"));
                    fnewRow[5]=rs.getString("folioref");
                    fnewRow[6]=this.findcolumna_destienda(mespartido);
                    jtable_modelo_detalledistri_interno.addRow(fnewRow);

                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
//     fnewRow[0]="Total Piezas:";
//     jtable_modelo_distribucion.addRow(fnewRow);
//     fnewRow[0]="Total Importe:";
//     jtable_modelo_distribucion.addRow(fnewRow);
//     this.contruir_totales_distribucionalma();
     }

private void crea_hoja_distribucionalmacen(String codigo,String cantidad,int columna,String cliente)
    {
        DecimalFormat miformat = new DecimalFormat("#########.##");
        int numerofilas=this.jtable_modelo_detalledistribucion.getRowCount();
        String idstat="";
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=00;
        int encontrado=0;
        Object[] fnewRow = new Object[numerocolumnas];
        float cantifam=0;
       //invoco al metodo que trae el recordset de datos
        cantifam=Float.valueOf(cantidad);
        for( ii=0;ii<numerofilas;ii++)
                {
                    idstat=jtable_modelo_detalledistribucion.getValueAt(ii, 0).toString();
                    if (idstat.equals(codigo))
                        {
                            System.out.println("Agregando:"+cantidad+" "+codigo);
                            encontrado=1;
                            jtable_modelo_detalledistribucion.setValueAt(miformat.format(cantifam),ii ,columna);
                        }
                }
        numerofilas=this.jtable_modelo_detalledistri_interno.getRowCount();
             for( ii=0;ii<numerofilas;ii++)
                {
                    idstat=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                    if ((idstat.equals(codigo)) && (cliente.equals(jtable_modelo_detalledistri_interno.getValueAt(ii, 0).toString())))
                        {
                            System.out.println("Agregando:"+cantidad+" "+codigo);
                            encontrado=1;
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(cantifam),ii ,2);
                        }
                }
        
       
    }
private void crea_hoja_distribucionalmacen(String arreglof[],String idcliente,int columna)
    {
        DecimalFormat miformat = new DecimalFormat("#########.####");
        int numerofilasd=this.jtable_modelo_detallecompra.getRowCount(),numerofilasdi=this.jtable_modelo_detalledistribucion.getRowCount(),numerofilasdici=this.jtable_modelo_detalledistri_interno.getRowCount();

        String idstat="",idclista="",idclientemodelo[]=null;
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=00,encontrado=0,nclie=0,folioref=0;
        Object[] fnewRow = new Object[numerocolumnas],fnewRowdet = new Object[19];
        float cantiant=0;
       //reviso en la tabla de detalle si ya existe para solo aumentar la cantidad
        for( ii=0;ii<numerofilasd;ii++)
                {
                    idstat=jtable_modelo_detallecompra.getValueAt(ii, 1).toString();
                    if (idstat.equals(arreglof[0].trim().toUpperCase()))
                        {
                            encontrado=1;
                            cantiant=Float.valueOf(jtable_modelo_detallecompra.getValueAt(ii, 7).toString());
                            jtable_modelo_detallecompra.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii ,7);
                            //para acumular Diferencia
                            if(idcliente.equals("0"))
                                {
                                    cantiant=Float.valueOf(jtable_modelo_detallecompra.getValueAt(ii, 17).toString());
                                    jtable_modelo_detallecompra.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii ,17);
                                }
                        }

                }
        //si ya existe significa que tambien existe ne distribucion y controlinterno de distribucion
        if(encontrado==1)
            {
                //actualiso la Distribucion
                for( ii=0;ii<numerofilasdi;ii++)
                {
                    idstat=jtable_modelo_detalledistribucion.getValueAt(ii, 0).toString();
                    if (idstat.equals(arreglof[0].trim().toUpperCase()))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistribucion.getValueAt(ii, columna).toString());
                            jtable_modelo_detalledistribucion.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,columna);
                        }
                }
                //actualizo distribucion de Control Interno
                for( ii=0;ii<numerofilasdici;ii++)
                {
                    idclista=jtable_modelo_detalledistri_interno.getValueAt(ii, 0).toString();
                    idstat=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                    if ((idstat.equals(arreglof[0].trim().toUpperCase())) && (idclista.equals(idcliente)))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistri_interno.getValueAt(ii, 2).toString());
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,2);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[6])),ii,3);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[7])),ii,4);
                        }
                }
            }
       folioref=0;
       if(encontrado==0)
            {
                fnewRowdet[0]=numerofilasd+1;
                fnewRowdet[1]=arreglof[0].trim().toUpperCase(); //codigo
                fnewRowdet[2]=arreglof[1].trim().toUpperCase();//descripcion
               if(arreglof[2].toString().length()>19)
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase().substring(0, 19);//desc. corta
                else
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase();//desc. corta

                fnewRowdet[4]=arreglof[3].trim().toUpperCase();//item original proveedor
                fnewRowdet[5]=arreglof[4].trim().toUpperCase();//Item Derivado michelle
                fnewRowdet[6]=arreglof[5].trim().toUpperCase();
                fnewRowdet[7]=arreglof[10].trim().toUpperCase();
                fnewRowdet[8]=arreglof[6].trim().toUpperCase();
                fnewRowdet[9]=arreglof[8].trim().toUpperCase();
                fnewRowdet[10]=this.jtf_descuento.getText();
                fnewRowdet[11]=this.jtf_impuesto.getText();
                fnewRowdet[12]="0";
                fnewRowdet[13]=".";
                fnewRowdet[14]=arreglof[9].trim().toUpperCase();
                if(arreglof[11].trim().length()>1)
                fnewRowdet[15]=arreglof[11].trim().toUpperCase();
                else
                 fnewRowdet[15]=".";
                 fnewRowdet[16]=arreglof[7].trim().toUpperCase();
                fnewRowdet[17]="0";
                fnewRowdet[18]="r";
            jtable_modelo_etiqueta.addRow(new Object[]{fnewRowdet[1],fnewRowdet[3],fnewRowdet[9],this.jtf_clavecantidad.getText().toString(),fnewRowdet[5]});
            jtable_modelo_detallecompra.addRow(fnewRowdet);

            fnewRow[0]=arreglof[0].trim().toUpperCase();
            fnewRow[1]=arreglof[3].trim().toUpperCase();
            fnewRow[2]=arreglof[6].trim().toUpperCase();
            fnewRow[3]=arreglof[8].trim().toUpperCase();
            for( ii=4;ii<numerocolumnas-1;ii++)
                {
                folioref++;
                idclientemodelo=this.modelo.getElementAt(nclie).toString().split(":");
                               if(ii==columna)
                                    {
                                        fnewRow[ii]=arreglof[10];
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),arreglof[10].trim().toUpperCase(),arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1]});
                                    }
                               else
                                    {
                                        fnewRow[ii]="0";
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),"0",arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1]});
                                    }
                               nclie++;
                }
            fnewRow[numerocolumnas-1]="0";
             jtable_modelo_detalledistribucion.addRow(fnewRow);
           }
    }

private void crea_hoja_distribucionalmacen_mas(String arreglof[],String idcliente,int columna)
    {
        DecimalFormat miformat = new DecimalFormat("#########.##");
        int numerofilasd=this.jtable_modelo_detallecompra.getRowCount(),numerofilasdi=this.jtable_modelo_detalledistribucion.getRowCount(),numerofilasdici=this.jtable_modelo_detalledistri_interno.getRowCount();

        String idstat="",idclista="",idclientemodelo[]=null,prov="",idprov="";
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=00,encontrado=0,nclie=0,folioref=0;
        Object[] fnewRow = new Object[numerocolumnas],fnewRowdet = new Object[19];
        float cantiant=0;
       //reviso en la tabla de detalle si ya existe para solo aumentar la cantidad
        for( ii=0;ii<numerofilasd;ii++)
                {
                    idstat=jtable_modelo_detallecompra.getValueAt(ii, 1).toString();
                    prov=jtable_modelo_detallecompra.getValueAt(ii, 13).toString();
                    if ((idstat.equals(arreglof[0].trim().toUpperCase())) &&((prov.equals(arreglof[12].trim().toUpperCase()))))
                        {
                            encontrado=1;
                            cantiant=Float.valueOf(jtable_modelo_detallecompra.getValueAt(ii, 7).toString());
                            jtable_modelo_detallecompra.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii ,7);
                        }
                }
        //si ya existe significa que tambien existe ne distribucion y controlinterno de distribucion
        if(encontrado==1)
            {
                //actualiso la Distribucion
                for( ii=0;ii<numerofilasdi;ii++)
                {
                    idstat=jtable_modelo_detalledistribucion.getValueAt(ii, 0).toString();
                    if (idstat.equals(arreglof[0].trim().toUpperCase()))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistribucion.getValueAt(ii, columna).toString());
                            jtable_modelo_detalledistribucion.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,columna);
                        }
                }
                //actualizo distribucion de Control Interno
                for( ii=0;ii<numerofilasdici;ii++)
                {
                    idclista=jtable_modelo_detalledistri_interno.getValueAt(ii, 0).toString();
                    idstat=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                    idprov=jtable_modelo_detalledistri_interno.getValueAt(ii, 7).toString();
                    if ((idstat.equals(arreglof[0].trim().toUpperCase())) && (idclista.equals(idcliente)) && (idprov.equals(arreglof[12].trim().toUpperCase())))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistri_interno.getValueAt(ii, 2).toString());
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,2);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[6])),ii,3);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[7])),ii,4);
                        }
                }
            }
       folioref=0;
       if(encontrado==0)
            {
                fnewRowdet[0]=numerofilasd+1;
                fnewRowdet[1]=arreglof[0].trim().toUpperCase(); //codigo
                fnewRowdet[2]=arreglof[1].trim().toUpperCase();//descripcion
               if(arreglof[2].toString().length()>19)
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase().substring(0, 19);//desc. corta
                else
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase();//desc. corta

                fnewRowdet[4]=arreglof[3].trim().toUpperCase();//item original proveedor
                fnewRowdet[5]=arreglof[4].trim().toUpperCase();//Item Derivado michelle
                fnewRowdet[6]=arreglof[5].trim().toUpperCase();
                fnewRowdet[7]=arreglof[10].trim().toUpperCase();
                fnewRowdet[8]=arreglof[6].trim().toUpperCase();
                fnewRowdet[9]=arreglof[8].trim().toUpperCase();
                fnewRowdet[10]=this.jtf_descuento.getText();
                fnewRowdet[11]=this.jtf_impuesto.getText();
                fnewRowdet[12]="0";
                fnewRowdet[13]=arreglof[12].trim().toUpperCase();
                fnewRowdet[14]=arreglof[9].trim().toUpperCase();
                if(arreglof[11].trim().length()>1)
                fnewRowdet[15]=arreglof[11].trim().toUpperCase();
                else
                 fnewRowdet[15]=".";
                 fnewRowdet[16]=arreglof[7].trim().toUpperCase();
                 fnewRowdet[17]="0";
                  fnewRowdet[18]=arreglof[14].trim();
            jtable_modelo_etiqueta.addRow(new Object[]{fnewRowdet[1],fnewRowdet[3],fnewRowdet[9],this.jtf_clavecantidad.getText().toString(),fnewRowdet[5]});
            jtable_modelo_detallecompra.addRow(fnewRowdet);

            fnewRow[0]=arreglof[0].trim().toUpperCase();
            fnewRow[1]=arreglof[3].trim().toUpperCase();
            fnewRow[2]=arreglof[6].trim().toUpperCase();
            fnewRow[3]=arreglof[8].trim().toUpperCase();
            for( ii=4;ii<numerocolumnas-1;ii++)
                {
                folioref++;
                idclientemodelo=this.modelo.getElementAt(nclie).toString().split(":");
                               if(ii==columna)
                                    {
                                        fnewRow[ii]=arreglof[10];
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),arreglof[10].trim().toUpperCase(),arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1],arreglof[12].trim().toUpperCase()});
                                    }
                               else
                                    {
                                        fnewRow[ii]="0";
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),"0",arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1],arreglof[12].trim().toUpperCase()});
                                    }
                               nclie++;
                }
            fnewRow[numerocolumnas-1]="0";
             jtable_modelo_detalledistribucion.addRow(fnewRow);
           }
    }

private void crea_hoja_distribucionalmacen_massd(String arreglof[],String idcliente,int columna)
    {
        DecimalFormat miformat = new DecimalFormat("#########.##");
        int numerofilasd=this.jtable_modelo_detallecompra.getRowCount(),numerofilasdi=this.jtable_modelo_detalledistribucion.getRowCount(),numerofilasdici=this.jtable_modelo_detalledistri_interno.getRowCount();

        String idstat="",idclista="",idclientemodelo[]=null,prov="",idprov="";
        int numerocolumnas=this.jtable_modelo_detalledistribucion.getColumnCount(),ii=00,encontrado=0,nclie=0,folioref=0;
        Object[] fnewRow = new Object[numerocolumnas],fnewRowdet = new Object[19];
        float cantiant=0;
       //reviso en la tabla de detalle si ya existe para solo aumentar la cantidad
        /*for( ii=0;ii<numerofilasd;ii++)
                {
                    idstat=jtable_modelo_detallecompra.getValueAt(ii, 1).toString();
                    prov=jtable_modelo_detallecompra.getValueAt(ii, 13).toString();
                    if ((idstat.equals(arreglof[0].trim().toUpperCase())) &&((prov.equals(arreglof[12].trim().toUpperCase()))))
                        {
                            encontrado=1;
                            cantiant=Float.valueOf(jtable_modelo_detallecompra.getValueAt(ii, 7).toString());
                            jtable_modelo_detallecompra.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii ,7);
                        }
                }
        //si ya existe significa que tambien existe ne distribucion y controlinterno de distribucion
        if(encontrado==1)
            {
                //actualiso la Distribucion
                for( ii=0;ii<numerofilasdi;ii++)
                {
                    idstat=jtable_modelo_detalledistribucion.getValueAt(ii, 0).toString();
                    if (idstat.equals(arreglof[0].trim().toUpperCase()))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistribucion.getValueAt(ii, columna).toString());
                            jtable_modelo_detalledistribucion.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,columna);
                        }
                }
                //actualizo distribucion de Control Interno
                for( ii=0;ii<numerofilasdici;ii++)
                {
                    idclista=jtable_modelo_detalledistri_interno.getValueAt(ii, 0).toString();
                    idstat=jtable_modelo_detalledistri_interno.getValueAt(ii, 1).toString();
                    idprov=jtable_modelo_detalledistri_interno.getValueAt(ii, 7).toString();
                    if ((idstat.equals(arreglof[0].trim().toUpperCase())) && (idclista.equals(idcliente)) && (idprov.equals(arreglof[12].trim().toUpperCase())))
                        {
                            cantiant=Float.valueOf(jtable_modelo_detalledistri_interno.getValueAt(ii, 2).toString());
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[10])+cantiant),ii,2);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[6])),ii,3);
                            jtable_modelo_detalledistri_interno.setValueAt(miformat.format(Float.valueOf(arreglof[7])),ii,4);
                        }
                }
            }
       folioref=0;
       if(encontrado==0)
            {*/
                fnewRowdet[0]=numerofilasd+1;
                fnewRowdet[1]=arreglof[0].trim().toUpperCase(); //codigo
                fnewRowdet[2]=arreglof[1].trim().toUpperCase();//descripcion
               if(arreglof[2].toString().length()>19)
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase().substring(0, 19);//desc. corta
                else
                    fnewRowdet[3]=arreglof[2].trim().toUpperCase();//desc. corta

                fnewRowdet[4]=arreglof[3].trim().toUpperCase();//item original proveedor
                fnewRowdet[5]=arreglof[4].trim().toUpperCase();//Item Derivado michelle
                fnewRowdet[6]=arreglof[5].trim().toUpperCase();
                fnewRowdet[7]=arreglof[10].trim().toUpperCase();
                fnewRowdet[8]=arreglof[6].trim().toUpperCase();
                fnewRowdet[9]=arreglof[8].trim().toUpperCase();
                fnewRowdet[10]=this.jtf_descuento.getText();
                fnewRowdet[11]=this.jtf_impuesto.getText();
                fnewRowdet[12]="0";
                fnewRowdet[13]=arreglof[12].trim().toUpperCase();
                fnewRowdet[14]=arreglof[9].trim().toUpperCase();
                if(arreglof[11].trim().length()>1)
                fnewRowdet[15]=arreglof[11].trim().toUpperCase();
                else
                 fnewRowdet[15]=".";
                 fnewRowdet[16]=arreglof[7].trim().toUpperCase();
                 fnewRowdet[17]="0";
                 fnewRowdet[18]=arreglof[14].trim();
                 jtable_modelo_detallecompra.addRow(fnewRowdet);
            /*jtable_modelo_etiqueta.addRow(new Object[]{fnewRowdet[1],fnewRowdet[3],fnewRowdet[9],this.jtf_clavecantidad.getText().toString(),fnewRowdet[5]});
            

            fnewRow[0]=arreglof[0].trim().toUpperCase();
            fnewRow[1]=arreglof[3].trim().toUpperCase();
            fnewRow[2]=arreglof[6].trim().toUpperCase();
            fnewRow[3]=arreglof[8].trim().toUpperCase();
            for( ii=4;ii<numerocolumnas-1;ii++)
                {
                folioref++;
                idclientemodelo=this.modelo.getElementAt(nclie).toString().split(":");
                               if(ii==columna)
                                    {
                                        fnewRow[ii]=arreglof[10];
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),arreglof[10].trim().toUpperCase(),arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1],arreglof[12].trim().toUpperCase()});
                                    }
                               else
                                    {
                                        fnewRow[ii]="0";
                                        jtable_modelo_detalledistri_interno.addRow(new Object[]{idclientemodelo[0],arreglof[0].trim().toUpperCase(),"0",arreglof[6].trim().toUpperCase(),arreglof[7].trim().toUpperCase(),numerofilasd+1,idclientemodelo[1],arreglof[12].trim().toUpperCase()});
                                    }
                               nclie++;
                }
            fnewRow[numerocolumnas-1]="0";
             jtable_modelo_detalledistribucion.addRow(fnewRow);
           }*/
    }

private void carga_datos(int opbus,String tbusca)
    {
        String fechacat = "",fechallegatienda="",fechaentrega="";
         DecimalFormat miformat = new DecimalFormat("###,###,###,###");
         String abrehtml="",cierrahtml="",texto="";
         while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
         texto="select * from x1distribucion_terminados_ventas_catalogov2('"+variables_global.getcliente_tistribucion()+"',"+opbus+",'"+tbusca+"') as (idreg integer,id character varying(12),idesta smallint,desta character varying(15), claveperdoc character varying(45),dante character varying(12), doctosig character varying(12),fedoc text,feent text,fechaven date,impuesto1 numeric,impuesto2 numeric,descuentotot numeric,descuentofin numeric,idcliente character varying(12),nomclie character varying(60),obserdoc character varying(80), usuario character varying(20),flete numeric,guia character varying(60), fechaenvio date,idmoneda smallint,descripmoneda character varying(30),idalmacen smallint,describamacen character varying(30),total numeric,tpz numeric,distra integer,clasif smallint,distrans2 integer);";
       //invoco al metodo que trae el recordset de datos
        System.out.println("ho:"+texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                 switch (rs.getInt("idesta"))
                    {
                        case 1:
                            abrehtml="<html><b><font color=#CC0000>";
                            cierrahtml="<font></b></html>";
                        break;
                        case 4:
                            abrehtml="<html><b><font color=#FF6633>";
                            cierrahtml="<font></b></html>";
                        break;
                        default:
                             abrehtml="<html>";
                            cierrahtml="</html>";
                        break;
                    }
                 if(rs.getString("fechaven")!=null)
                        {
                           fechallegatienda="<html>"+ this.fechaeuropea(rs.getString("fechaven"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString("fechaven")))+"</html>";
                        }
                    if(rs.getString("feent")!=null)
                        {
                            fechaentrega="<html>"+rs.getString ("feent")+":<br>"+this.DiaSemana(rs.getString("feent"))+"</html>";
                        }
                fechacat="<html>"+rs.getString("fedoc")+":<br>"+DiaSemana(rs.getString("fedoc")+"</html>");
                jtable_modelo.addRow(new Object[]{rs.getString ("id"),abrehtml+rs.getString ("idesta")+":"+rs.getString ("desta")+cierrahtml,abrehtml+rs.getString ("idcliente")+":"+rs.getString ("nomclie")+cierrahtml,abrehtml+rs.getString ("dante")+cierrahtml,fechacat,fechallegatienda,fechaentrega,abrehtml+rs.getString ("distra")+cierrahtml,abrehtml+rs.getString ("guia")+cierrahtml,abrehtml+miformat.format(rs.getFloat("tpz"))+cierrahtml,abrehtml+miformat.format(rs.getFloat("total"))+cierrahtml,abrehtml+rs.getString ("obserdoc")+cierrahtml});
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
/*        texto="select * from x1distribucion_terminados_almacen_entradas_catalogo(2,'"+tbusca+"','') as (idfol integer,id character varying(12),idesta smallint,desta character varying(15),claveperdoc character varying(12),dante character varying(12),dsiguiente character varying(12), fedoc date,feent date,fechaven date,impuesto numeric,impuesto2 numeric,destotot numeric,destofinan numeric,idproveedor character varying(12), idprovdescribe character varying(60),obserdoc character varying(255),usuario character varying(12), flete numeric,guia character varying(60),fechaenvio date,idmoneda smallint,describemoneda character varying(30),idalmacen smallint,describealmacehr character varying(30),pzaente numeric,pzasal numeric,importeent numeric,importesal numeric);";
        System.out.println("ho:"+texto);
        try
        {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                    if(rs.getString("fechaven") != null)
                        {
                           fechallegatienda="<html>"+ this.fechaeuropea(rs.getString("fechaven"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString ("fechaven")))+"</html>";
                        }
                    if(rs.getString("feent")!=null)
                        {
                            fechaentrega="<html>"+rs.getString ("feent")+":<br>"+this.DiaSemana(this.fechaeuropea(rs.getString("feent")))+"</html>";
                        }
                fechacat="<html>"+this.fechaeuropea(rs.getString ("fedoc"))+":<br>"+DiaSemana(this.fechaeuropea(rs.getString("fedoc"))+"</html>");
                switch (rs.getInt("idesta"))
                    {
                        case 1:
                            jtable_modelo.addRow(new Object[]{rs.getString ("id"),rs.getString("idesta")+":"+rs.getString("desta"),"09:Entrada Almacen",rs.getString ("dante"),fechacat,fechallegatienda,fechaentrega,"",abrehtml+rs.getString ("guia")+cierrahtml,abrehtml+miformat.format(rs.getFloat("pzasal"))+cierrahtml,abrehtml+miformat.format(rs.getFloat("importesal"))+cierrahtml,abrehtml+rs.getString ("obserdoc")+cierrahtml});
                        break;
                        case 2:
                            jtable_modelo.addRow(new Object[]{rs.getString ("id"),rs.getString("idesta")+":"+rs.getString("desta"),"0:DIFERENCIA FALTANTE O SOBRANTE",rs.getString ("dante"),fechacat,fechallegatienda,fechaentrega,"",abrehtml+rs.getString ("guia")+cierrahtml,abrehtml+miformat.format(rs.getFloat("pzasal"))+cierrahtml,abrehtml+miformat.format(rs.getFloat("importesal"))+cierrahtml,abrehtml+rs.getString ("obserdoc")+cierrahtml});
                        break;
                    }
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
*/

       int numerofilas=this.jtable_modelo.getRowCount();
             for(int i = 0 ;i < numerofilas; i++)
                {
                     jtbl_recepciones.setRowHeight(i, 30);
                }
      }

private void carga_datos_distribucionxclie(String idref)
    {
        DecimalFormat miformat = new DecimalFormat("###,###,###,###.##");
        String texto="select * from x1distribucion_terminados_distribucion_xcliente(1,'"+idref+"','') as (idref character varying(12),idclieoprov character varying(16),cantpza numeric,costoinve numeric,precioinve numeric,precio5 numeric,clieoprovdesc character varying(60));";
        try
        {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                        this.crea_hoja_distribucionaclientes(rs.getString("idclieoprov"),rs.getString("idref"),rs.getString("clieoprovdesc"),rs.getString("cantpza"),miformat.format(rs.getFloat("costoinve")));
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }



        int numerofilas=this.jtable_modelo.getRowCount();
             for(int i = 0 ;i < numerofilas; i++)
                {
                     jtbl_recepciones.setRowHeight(i, 30);
                }
     }
private void crea_hoja_distribucionaclientes(String codigo,String doctoref,String cliente,String cantidad,String costo)
    {
        DecimalFormat miformat = new DecimalFormat("###,###,###");
        int numerofilas=this.jtable_modelo.getRowCount();
        String idstat[]=null;
        int ii=00,encontrado=0;
        Object[] fnewRow = new Object[12];
        for( ii=0;ii<numerofilas;ii++)
                {
                    idstat=jtable_modelo.getValueAt(ii, 2).toString().replace("<html><b><font color=#CC0000>", "").replace("<html><b><font color=#FF6633>", "").replace("<html>", "").split(":");
                    if (idstat[0].equals(codigo))
                        {
                            encontrado=1;
                        }
                }
       if(encontrado==0)
            {
               fnewRow[0]="0";
               fnewRow[1]="SIN FOLIO";
               fnewRow[2]=codigo+":"+cliente;
               fnewRow[3]=doctoref;
               fnewRow[4]="";
               fnewRow[5]="";
               fnewRow[6]="";
               fnewRow[7]="";
               fnewRow[8]="";
               fnewRow[9]=cantidad;
               fnewRow[10]=costo;
               fnewRow[11]="";

               jtable_modelo.addRow(fnewRow);
            }
    }
private String fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }

 private void dioclickr(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        int fila = jtbl_recepciones.getSelectedRow();
        Object valor = jtbl_recepciones.getValueAt(fila, 0);
        //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
        com_distri_folios_detalle fdd=new com_distri_folios_detalle(String.valueOf(valor));
        fdd.pack();
        fdd.setVisible(true);
    }

 private void articulo_buscar(int rbbuscam,int rbopbuscam,String busqueda)
 {
       String texto="select * from x1distribucion_terminados_articulos_catalogov2("+rbbuscam+","+rbopbuscam+",'"+busqueda+"') as (id character varying(16),codbarra character varying(16),idstatus smallint,statusdescribe text,describearticulo character varying(80),describcorta character varying(20),unsal character varying(3),unent character varying(3),facentruni numeric,uniempaque character varying(12),idtempo smallint,describetemp text,idfamilia character varying(5),familiadescribe character varying(40),controlalma character varying(20),stocminimo numeric,stocmaximo numeric,precio1 numeric,precio2 numeric,precio3 numeric,precio4 numeric,precio5 numeric,ultimocosto numeric,costoprom numeric,pensurtir numeric,tiemposurtido smallint,acumprod numeric,acumimporte numeric,idtipoarticulo smallint,tipodescribe text,fechaprototipo date,fechaautoriza date,fechainiprod date,fechaultimaent date,usuario character varying(20),observacion character varying(255),idprovee character varying(12),descripprovee character varying(60),nombrecreador character varying(80),valor_x character varying(20),valorx_st character varying(20),idpersonal character varying(16),nombrepersonal character varying(80),idlinea smallint,describelinea text,existenciaf numeric,almacenlugar text,existencia numeric)";
       System.out.println(texto);
       int banderafin=0;
       DecimalFormat miformat = new DecimalFormat("############.##");
       try
        {
           rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                this.jtf_idarticulo.setText(rs.getString("id"));

                this.jtf_clavedescor.setText(rs.getString("codbarra"));
                this.jtf_insumodescripcion.setText(rs.getString("describearticulo"));
                this.jtf_itemprov.setText(rs.getString("valor_x"));
                this.jtf_costo.setText(miformat.format(rs.getFloat("ultimocosto")));
                this.jtf_precioventa.setText(miformat.format(rs.getFloat("precio5")));
                banderafin=1;
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
     if(banderafin==0)
         {
           JOptionPane.showMessageDialog(null,"Clave:"+busqueda+" No Encontrado", "Sistema Integral(Modificar articulo) : Ayuda",1);
         }
 }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jtf_idproveedor = new javax.swing.JTextField();
        tf_foliodoctoanterior = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jdc_fechadocto = new com.toedter.calendar.JDateChooser();
        jdc_fecharef = new com.toedter.calendar.JDateChooser();
        jdc_fecharecepcion = new com.toedter.calendar.JDateChooser();
        jLabel2 = new javax.swing.JLabel();
        jtf_impuesto = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtf_descuento = new javax.swing.JTextField();
        jtf_describeproveedor = new javax.swing.JTextField();
        jcmbx_clasifviaje = new javax.swing.JComboBox();
        jCheckBox1 = new javax.swing.JCheckBox();
        jLabel39 = new javax.swing.JLabel();
        jtf_idfolio = new javax.swing.JTextField();
        jep_observaciones = new javax.swing.JTextField();
        jLabel44 = new javax.swing.JLabel();
        jtf_fleteygastos = new javax.swing.JTextField();
        jtf_fleteygastospor = new javax.swing.JTextField();
        jtf_fleteygastos1 = new javax.swing.JTextField();
        jtf_doctosubtotal1 = new javax.swing.JTextField();
        jtf_doctodesc1 = new javax.swing.JTextField();
        jtf_doctoimp1 = new javax.swing.JTextField();
        jtf_doctototal1 = new javax.swing.JTextField();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jpn_cuerpo = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtb_terminadosentrada = new javax.swing.JTable()
        //{
            //  public boolean isCellEditable(int rowIndex, int mColIndex) {
                //    if (mColIndex < 3)
                //  return false;
                //else
                //return true;
                //}
            //}
        ;
        jLabel11 = new javax.swing.JLabel();
        jtf_doctosubtotal = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jtf_doctodesc = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jtf_doctoimp = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jtf_doctototal = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jtf_cantidadpiezas = new javax.swing.JTextField();
        jbtn_salir = new javax.swing.JButton();
        jbtn_helpayudame = new javax.swing.JButton();
        jLabel43 = new javax.swing.JLabel();
        jtf_totalcostov = new javax.swing.JTextField();
        jbtn_agregar1 = new javax.swing.JButton();
        jbtn_eliminar = new javax.swing.JButton();
        jLabel46 = new javax.swing.JLabel();
        jtf_cantidadpiezas1 = new javax.swing.JTextField();
        jLabel47 = new javax.swing.JLabel();
        jtf_cantidadpiezas2 = new javax.swing.JTextField();
        jbtn_agregar2 = new javax.swing.JButton();
        jtf_totalpreciopublic = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        jtb_distribucioncontrolinterno1 = new javax.swing.JTable()
        //{
            //  public boolean isCellEditable(int rowIndex, int mColIndex) {
                //    if (mColIndex < 3)
                //  return false;
                //else
                //return true;
                //}
            //}
        ;
        jtf_piezasxparupdate = new javax.swing.JTextField();
        jLabel40 = new javax.swing.JLabel();
        jbtn_distribucionupdate = new javax.swing.JButton();
        jtf_actualizadisclave = new javax.swing.JTextField();
        jPanel12 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jtb_distribucion = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jbtn_guardar = new javax.swing.JButton();
        jbtn_agregar = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jtb_distribucioncontrolinterno = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jPanel13 = new javax.swing.JPanel();
        jScrollPane10 = new javax.swing.JScrollPane();
        jtb_distribucioncontrolinterno2 = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jButton1 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jta_archivo = new javax.swing.JTextArea();
        jbtn_importar = new javax.swing.JButton();
        jLabel24 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jlst_clientesdistribucion = new javax.swing.JList();
        jLabel9 = new javax.swing.JLabel();
        jtf_tiendaactual = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jtf_viajedescribe = new javax.swing.JTextField();
        jbtn_crearviaje = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jtf_viajeobservaciones = new javax.swing.JTextField();
        jtf_viajeinicial = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        jLabel41 = new javax.swing.JLabel();
        jbtn_importar1 = new javax.swing.JButton();
        jLabel45 = new javax.swing.JLabel();
        jbtn_importar2 = new javax.swing.JButton();
        jbtn_importar3 = new javax.swing.JButton();
        jPanel14 = new javax.swing.JPanel();
        jLabel42 = new javax.swing.JLabel();
        jtf_observa_update = new javax.swing.JTextField();
        jbtn_actualizar = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jtf_idarticulo = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jtf_insumodescripcion = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jtf_clavedescor = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jtf_unidadsal = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jtf_costo = new javax.swing.JTextField();
        jlbl_costo2 = new javax.swing.JLabel();
        jtf_itemprov = new javax.swing.JTextField();
        jlbl_costo3 = new javax.swing.JLabel();
        jtf_itemderi = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jtf_contruirinip = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jtf_claveiv = new javax.swing.JTextField();
        jtf_clavetc = new javax.swing.JTextField();
        jcbx_familia = new javax.swing.JComboBox();
        jLabel30 = new javax.swing.JLabel();
        jcbx_iddescricorta = new javax.swing.JComboBox();
        jLabel31 = new javax.swing.JLabel();
        jcbx_clavemes = new javax.swing.JComboBox();
        jcbx_claveyear = new javax.swing.JComboBox();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jtf_precioventa = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        jtf_clavecantidad = new javax.swing.JTextField();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jtb_distribucionalta = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                if (mColIndex < 2)
                return false;
                else
                return true;
            }
        }
        ;
        jtf_distritotalpz = new javax.swing.JTextField();
        jLabel38 = new javax.swing.JLabel();
        jbtn_agregardistribucionprevia = new javax.swing.JButton();
        jtf_distripzfal = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        jtf_distripzsob = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jtf_distripzxtie = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jtf_distripzalma = new javax.swing.JTextField();
        jbtn_agregapartidalocal = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        jtbl_recepciones = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }}
            ;
            jbtn_cargardistribucionxclie = new javax.swing.JButton();
            jtf_idffila = new javax.swing.JTextField();
            jtf_idcliente = new javax.swing.JTextField();
            jtf_describecliente = new javax.swing.JTextField();
            jtf_pzasdistri = new javax.swing.JTextField();
            jbtn_generarventa = new javax.swing.JButton();
            jbtn_generarventa1 = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jmni_salir = new javax.swing.JMenuItem();
            jmni_salirsinguardar = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            jmni_escape = new javax.swing.JMenuItem();
            jckbx_redondear = new javax.swing.JCheckBoxMenuItem();
            jckbx_simularred = new javax.swing.JCheckBoxMenuItem();
            jmni_limpiardocto = new javax.swing.JMenuItem();
            jmni_altaprovee = new javax.swing.JMenuItem();
            jmni_guardar = new javax.swing.JMenuItem();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenuItem2 = new javax.swing.JMenuItem();

            setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
            org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(com_distri_compras_alta.class);
            setTitle(resourceMap.getString("Form.title")); // NOI18N
            setName("Form"); // NOI18N

            jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
            jPanel3.setName("jPanel3"); // NOI18N

            jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
            jLabel6.setName("jLabel6"); // NOI18N

            jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
            jLabel5.setName("jLabel5"); // NOI18N

            jtf_idproveedor.setFont(resourceMap.getFont("jtf_idproveedor.font")); // NOI18N
            jtf_idproveedor.setToolTipText(resourceMap.getString("jtf_idproveedor.toolTipText")); // NOI18N
            jtf_idproveedor.setName("jtf_idproveedor"); // NOI18N
            jtf_idproveedor.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_idproveedorActionPerformed(evt);
                }
            });

            tf_foliodoctoanterior.setFont(resourceMap.getFont("tf_foliodoctoanterior.font")); // NOI18N
            tf_foliodoctoanterior.setToolTipText(resourceMap.getString("tf_foliodoctoanterior.toolTipText")); // NOI18N
            tf_foliodoctoanterior.setName("tf_foliodoctoanterior"); // NOI18N
            tf_foliodoctoanterior.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    tf_foliodoctoanteriorActionPerformed(evt);
                }
            });

            jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
            jLabel3.setName("jLabel3"); // NOI18N

            jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
            jLabel1.setName("jLabel1"); // NOI18N

            jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
            jLabel7.setName("jLabel7"); // NOI18N

            jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
            jLabel10.setName("jLabel10"); // NOI18N

            jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
            jLabel8.setName("jLabel8"); // NOI18N

            jdc_fechadocto.setDateFormatString(resourceMap.getString("jdc_fechadocto.dateFormatString")); // NOI18N
            jdc_fechadocto.setName("jdc_fechadocto"); // NOI18N

            jdc_fecharef.setDateFormatString(resourceMap.getString("jdc_fecharef.dateFormatString")); // NOI18N
            jdc_fecharef.setName("jdc_fecharef"); // NOI18N

            jdc_fecharecepcion.setDateFormatString(resourceMap.getString("jdc_fecharecepcion.dateFormatString")); // NOI18N
            jdc_fecharecepcion.setName("jdc_fecharecepcion"); // NOI18N

            jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
            jLabel2.setName("jLabel2"); // NOI18N

            jtf_impuesto.setFont(resourceMap.getFont("jtf_impuesto.font")); // NOI18N
            jtf_impuesto.setText(resourceMap.getString("jtf_impuesto.text")); // NOI18N
            jtf_impuesto.setToolTipText(resourceMap.getString("jtf_impuesto.toolTipText")); // NOI18N
            jtf_impuesto.setName("jtf_impuesto"); // NOI18N
            jtf_impuesto.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_impuestoActionPerformed(evt);
                }
            });

            jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
            jLabel4.setName("jLabel4"); // NOI18N

            jtf_descuento.setFont(resourceMap.getFont("jtf_descuento.font")); // NOI18N
            jtf_descuento.setText(resourceMap.getString("jtf_descuento.text")); // NOI18N
            jtf_descuento.setToolTipText(resourceMap.getString("jtf_descuento.toolTipText")); // NOI18N
            jtf_descuento.setName("jtf_descuento"); // NOI18N
            jtf_descuento.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_descuentoActionPerformed(evt);
                }
            });

            jtf_describeproveedor.setEditable(false);
            jtf_describeproveedor.setFont(resourceMap.getFont("jtf_describeproveedor.font")); // NOI18N
            jtf_describeproveedor.setToolTipText(resourceMap.getString("jtf_describeproveedor.toolTipText")); // NOI18N
            jtf_describeproveedor.setName("jtf_describeproveedor"); // NOI18N
            jtf_describeproveedor.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_describeproveedorActionPerformed(evt);
                }
            });

            jcmbx_clasifviaje.setName("jcmbx_clasifviaje"); // NOI18N
            jcmbx_clasifviaje.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcmbx_clasifviajeActionPerformed(evt);
                }
            });

            jCheckBox1.setText(resourceMap.getString("jCheckBox1.text")); // NOI18N
            jCheckBox1.setName("jCheckBox1"); // NOI18N
            jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jCheckBox1ActionPerformed(evt);
                }
            });

            jLabel39.setText(resourceMap.getString("jLabel39.text")); // NOI18N
            jLabel39.setName("jLabel39"); // NOI18N

            jtf_idfolio.setEditable(false);
            jtf_idfolio.setFont(resourceMap.getFont("jtf_idfolio.font")); // NOI18N
            jtf_idfolio.setText(resourceMap.getString("jtf_idfolio.text")); // NOI18N
            jtf_idfolio.setToolTipText(resourceMap.getString("jtf_idfolio.toolTipText")); // NOI18N
            jtf_idfolio.setName("jtf_idfolio"); // NOI18N
            jtf_idfolio.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_idfolioActionPerformed(evt);
                }
            });

            jep_observaciones.setText(resourceMap.getString("jep_observaciones.text")); // NOI18N
            jep_observaciones.setName("jep_observaciones"); // NOI18N

            jLabel44.setText(resourceMap.getString("jLabel44.text")); // NOI18N
            jLabel44.setName("jLabel44"); // NOI18N

            jtf_fleteygastos.setFont(resourceMap.getFont("jtf_fleteygastos.font")); // NOI18N
            jtf_fleteygastos.setText(resourceMap.getString("jtf_fleteygastos.text")); // NOI18N
            jtf_fleteygastos.setToolTipText(resourceMap.getString("jtf_fleteygastos.toolTipText")); // NOI18N
            jtf_fleteygastos.setName("jtf_fleteygastos"); // NOI18N
            jtf_fleteygastos.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_fleteygastosActionPerformed(evt);
                }
            });

            jtf_fleteygastospor.setFont(resourceMap.getFont("jtf_fleteygastospor.font")); // NOI18N
            jtf_fleteygastospor.setText(resourceMap.getString("jtf_fleteygastospor.text")); // NOI18N
            jtf_fleteygastospor.setToolTipText(resourceMap.getString("jtf_fleteygastospor.toolTipText")); // NOI18N
            jtf_fleteygastospor.setName("jtf_fleteygastospor"); // NOI18N
            jtf_fleteygastospor.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_fleteygastosporActionPerformed(evt);
                }
            });

            jtf_fleteygastos1.setFont(resourceMap.getFont("jtf_fleteygastos1.font")); // NOI18N
            jtf_fleteygastos1.setText(resourceMap.getString("jtf_fleteygastos1.text")); // NOI18N
            jtf_fleteygastos1.setToolTipText(resourceMap.getString("jtf_fleteygastos1.toolTipText")); // NOI18N
            jtf_fleteygastos1.setName("jtf_fleteygastos1"); // NOI18N
            jtf_fleteygastos1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_fleteygastos1ActionPerformed(evt);
                }
            });

            jtf_doctosubtotal1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctosubtotal1.setText(resourceMap.getString("jtf_doctosubtotal1.text")); // NOI18N
            jtf_doctosubtotal1.setName("jtf_doctosubtotal1"); // NOI18N

            jtf_doctodesc1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctodesc1.setText(resourceMap.getString("jtf_doctodesc1.text")); // NOI18N
            jtf_doctodesc1.setName("jtf_doctodesc1"); // NOI18N

            jtf_doctoimp1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctoimp1.setText(resourceMap.getString("jtf_doctoimp1.text")); // NOI18N
            jtf_doctoimp1.setName("jtf_doctoimp1"); // NOI18N

            jtf_doctototal1.setEditable(false);
            jtf_doctototal1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctototal1.setText(resourceMap.getString("jtf_doctototal1.text")); // NOI18N
            jtf_doctototal1.setName("jtf_doctototal1"); // NOI18N

            javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
            jPanel3.setLayout(jPanel3Layout);
            jPanel3Layout.setHorizontalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                            .addComponent(jLabel5)
                            .addGap(28, 28, 28)
                            .addComponent(jtf_idproveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jCheckBox1)
                            .addGap(8, 8, 8)
                            .addComponent(jtf_describeproveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jep_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel39)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_idfolio, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(jLabel7)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jdc_fecharef, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel10)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jdc_fecharecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(57, 57, 57)
                                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jcmbx_clasifviaje, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jLabel3)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(tf_foliodoctoanterior, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel4)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_impuesto, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel44)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_fleteygastos, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_fleteygastos1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_fleteygastospor, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_doctosubtotal1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_doctodesc1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jtf_doctoimp1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_doctototal1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(16, 16, 16)))
                    .addContainerGap())
            );
            jPanel3Layout.setVerticalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel39)
                            .addComponent(jtf_idfolio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jdc_fechadocto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel7)
                                        .addComponent(jLabel10))
                                    .addComponent(jdc_fecharef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(jdc_fecharecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel8)
                                    .addComponent(jcmbx_clasifviaje, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tf_foliodoctoanterior, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4)
                            .addComponent(jtf_descuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2)
                            .addComponent(jtf_impuesto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_fleteygastos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_fleteygastos1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_fleteygastospor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_doctosubtotal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_doctodesc1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtf_doctoimp1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel44))
                        .addComponent(jtf_doctototal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_idproveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5)
                        .addComponent(jtf_describeproveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jCheckBox1)
                        .addComponent(jLabel6)
                        .addComponent(jep_observaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(28, 28, 28))
            );

            jTabbedPane1.setName("jTabbedPane1"); // NOI18N
            jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
                public void stateChanged(javax.swing.event.ChangeEvent evt) {
                    jTabbedPane1StateChanged(evt);
                }
            });

            jpn_cuerpo.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
            jpn_cuerpo.setName("jpn_cuerpo"); // NOI18N

            jScrollPane1.setName("jScrollPane1"); // NOI18N

            jtb_terminadosentrada.setModel(this.jtable_modelo_detallecompra);
            jtb_terminadosentrada.setName("jtb_terminadosentrada"); // NOI18N
            jtb_terminadosentrada.setRowHeight(23);
            jtb_terminadosentrada.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    jtb_terminadosentradaPropertyChange(evt);
                }
            });
            jtb_terminadosentrada.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jtb_terminadosentradaKeyPressed(evt);
                }
            });
            jScrollPane1.setViewportView(jtb_terminadosentrada);

            jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
            jLabel11.setName("jLabel11"); // NOI18N

            jtf_doctosubtotal.setEditable(false);
            jtf_doctosubtotal.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctosubtotal.setText(resourceMap.getString("jtf_doctosubtotal.text")); // NOI18N
            jtf_doctosubtotal.setName("jtf_doctosubtotal"); // NOI18N

            jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
            jLabel12.setName("jLabel12"); // NOI18N

            jtf_doctodesc.setEditable(false);
            jtf_doctodesc.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctodesc.setText(resourceMap.getString("jtf_doctodesc.text")); // NOI18N
            jtf_doctodesc.setName("jtf_doctodesc"); // NOI18N

            jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
            jLabel13.setName("jLabel13"); // NOI18N

            jtf_doctoimp.setEditable(false);
            jtf_doctoimp.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctoimp.setText(resourceMap.getString("jtf_doctoimp.text")); // NOI18N
            jtf_doctoimp.setName("jtf_doctoimp"); // NOI18N

            jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
            jLabel14.setName("jLabel14"); // NOI18N

            jtf_doctototal.setEditable(false);
            jtf_doctototal.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_doctototal.setText(resourceMap.getString("jtf_doctototal.text")); // NOI18N
            jtf_doctototal.setName("jtf_doctototal"); // NOI18N

            jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
            jLabel19.setName("jLabel19"); // NOI18N

            jtf_cantidadpiezas.setEditable(false);
            jtf_cantidadpiezas.setText(resourceMap.getString("jtf_cantidadpiezas.text")); // NOI18N
            jtf_cantidadpiezas.setName("jtf_cantidadpiezas"); // NOI18N

            jbtn_salir.setIcon(resourceMap.getIcon("jbtn_salir.icon")); // NOI18N
            jbtn_salir.setText(resourceMap.getString("jbtn_salir.text")); // NOI18N
            jbtn_salir.setName("jbtn_salir"); // NOI18N
            jbtn_salir.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_salirActionPerformed(evt);
                }
            });

            jbtn_helpayudame.setIcon(resourceMap.getIcon("jbtn_helpayudame.icon")); // NOI18N
            jbtn_helpayudame.setText(resourceMap.getString("jbtn_helpayudame.text")); // NOI18N
            jbtn_helpayudame.setName("jbtn_helpayudame"); // NOI18N
            jbtn_helpayudame.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_helpayudameActionPerformed(evt);
                }
            });

            jLabel43.setText(resourceMap.getString("jLabel43.text")); // NOI18N
            jLabel43.setName("jLabel43"); // NOI18N

            jtf_totalcostov.setEditable(false);
            jtf_totalcostov.setFont(resourceMap.getFont("jtf_totalcostov.font")); // NOI18N
            jtf_totalcostov.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_totalcostov.setText(resourceMap.getString("jtf_totalcostov.text")); // NOI18N
            jtf_totalcostov.setName("jtf_totalcostov"); // NOI18N

            jbtn_agregar1.setIcon(resourceMap.getIcon("jbtn_agregar1.icon")); // NOI18N
            jbtn_agregar1.setText(resourceMap.getString("jbtn_agregar1.text")); // NOI18N
            jbtn_agregar1.setToolTipText(resourceMap.getString("jbtn_agregar1.toolTipText")); // NOI18N
            jbtn_agregar1.setActionCommand(resourceMap.getString("jbtn_agregar1.actionCommand")); // NOI18N
            jbtn_agregar1.setName("jbtn_agregar1"); // NOI18N
            jbtn_agregar1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_agregar1ActionPerformed(evt);
                }
            });

            jbtn_eliminar.setIcon(resourceMap.getIcon("jbtn_eliminar.icon")); // NOI18N
            jbtn_eliminar.setText(resourceMap.getString("jbtn_eliminar.text")); // NOI18N
            jbtn_eliminar.setName("jbtn_eliminar"); // NOI18N
            jbtn_eliminar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_eliminarActionPerformed(evt);
                }
            });

            jLabel46.setText(resourceMap.getString("jLabel46.text")); // NOI18N
            jLabel46.setName("jLabel46"); // NOI18N

            jtf_cantidadpiezas1.setEditable(false);
            jtf_cantidadpiezas1.setText(resourceMap.getString("jtf_cantidadpiezas1.text")); // NOI18N
            jtf_cantidadpiezas1.setName("jtf_cantidadpiezas1"); // NOI18N

            jLabel47.setText(resourceMap.getString("jLabel47.text")); // NOI18N
            jLabel47.setName("jLabel47"); // NOI18N

            jtf_cantidadpiezas2.setEditable(false);
            jtf_cantidadpiezas2.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
            jtf_cantidadpiezas2.setText(resourceMap.getString("jtf_cantidadpiezas2.text")); // NOI18N
            jtf_cantidadpiezas2.setName("jtf_cantidadpiezas2"); // NOI18N

            jbtn_agregar2.setIcon(resourceMap.getIcon("jbtn_agregar2.icon")); // NOI18N
            jbtn_agregar2.setText(resourceMap.getString("jbtn_agregar2.text")); // NOI18N
            jbtn_agregar2.setToolTipText(resourceMap.getString("jbtn_agregar2.toolTipText")); // NOI18N
            jbtn_agregar2.setActionCommand(resourceMap.getString("jbtn_agregar2.actionCommand")); // NOI18N
            jbtn_agregar2.setName("jbtn_agregar2"); // NOI18N
            jbtn_agregar2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_agregar2ActionPerformed(evt);
                }
            });

            jtf_totalpreciopublic.setEditable(false);
            jtf_totalpreciopublic.setText(resourceMap.getString("jtf_totalpreciopublic.text")); // NOI18N
            jtf_totalpreciopublic.setName("jtf_totalpreciopublic"); // NOI18N

            javax.swing.GroupLayout jpn_cuerpoLayout = new javax.swing.GroupLayout(jpn_cuerpo);
            jpn_cuerpo.setLayout(jpn_cuerpoLayout);
            jpn_cuerpoLayout.setHorizontalGroup(
                jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel46)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_cantidadpiezas1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel47)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_cantidadpiezas2, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jbtn_agregar1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jbtn_agregar2)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jLabel19)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jtf_totalpreciopublic))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jLabel11)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_doctosubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(12, 12, 12)
                            .addComponent(jLabel12)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_doctodesc, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(15, 15, 15)
                            .addComponent(jLabel13)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_doctoimp, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLabel14))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jbtn_salir)
                            .addGap(10, 10, 10)
                            .addComponent(jbtn_helpayudame)
                            .addGap(18, 18, 18)
                            .addComponent(jbtn_eliminar)
                            .addGap(18, 18, 18)
                            .addComponent(jLabel43)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jtf_totalcostov, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(8, 8, 8))
                        .addGroup(jpn_cuerpoLayout.createSequentialGroup()
                            .addComponent(jtf_doctototal, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())))
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1029, Short.MAX_VALUE)
            );
            jpn_cuerpoLayout.setVerticalGroup(
                jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpn_cuerpoLayout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(jtf_doctoimp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14)
                        .addComponent(jtf_doctototal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)
                        .addComponent(jtf_doctosubtotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_doctodesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel12)
                        .addComponent(jtf_cantidadpiezas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel19)
                        .addComponent(jtf_cantidadpiezas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel46)
                        .addComponent(jtf_cantidadpiezas2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel47))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jpn_cuerpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jtf_totalcostov, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel43)
                        .addComponent(jbtn_salir)
                        .addComponent(jbtn_helpayudame)
                        .addComponent(jbtn_eliminar)
                        .addComponent(jbtn_agregar1)
                        .addComponent(jbtn_agregar2)
                        .addComponent(jtf_totalpreciopublic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap())
            );

            jTabbedPane1.addTab(resourceMap.getString("jpn_cuerpo.TabConstraints.tabTitle"), jpn_cuerpo); // NOI18N

            jPanel1.setName("jPanel1"); // NOI18N

            jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel11.border.title"))); // NOI18N
            jPanel11.setName("jPanel11"); // NOI18N

            jScrollPane9.setName("jScrollPane9"); // NOI18N

            jtb_distribucioncontrolinterno1.setModel(this.jtable_modelo_detalledistri_intupdate);
            jtb_distribucioncontrolinterno1.setName("jtb_distribucioncontrolinterno1"); // NOI18N
            jtb_distribucioncontrolinterno1.setRowHeight(22);
            jtb_distribucioncontrolinterno1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    jtb_distribucioncontrolinterno1PropertyChange(evt);
                }
            });
            jtb_distribucioncontrolinterno1.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jtb_distribucioncontrolinterno1KeyPressed(evt);
                }
            });
            jScrollPane9.setViewportView(jtb_distribucioncontrolinterno1);

            jtf_piezasxparupdate.setEditable(false);
            jtf_piezasxparupdate.setText(resourceMap.getString("jtf_piezasxparupdate.text")); // NOI18N
            jtf_piezasxparupdate.setName("jtf_piezasxparupdate"); // NOI18N

            jLabel40.setText(resourceMap.getString("jLabel40.text")); // NOI18N
            jLabel40.setName("jLabel40"); // NOI18N

            jbtn_distribucionupdate.setText(resourceMap.getString("jbtn_distribucionupdate.text")); // NOI18N
            jbtn_distribucionupdate.setName("jbtn_distribucionupdate"); // NOI18N
            jbtn_distribucionupdate.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_distribucionupdateActionPerformed(evt);
                }
            });

            jtf_actualizadisclave.setEditable(false);
            jtf_actualizadisclave.setText(resourceMap.getString("jtf_actualizadisclave.text")); // NOI18N
            jtf_actualizadisclave.setName("jtf_actualizadisclave"); // NOI18N

            javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
            jPanel11.setLayout(jPanel11Layout);
            jPanel11Layout.setHorizontalGroup(
                jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel11Layout.createSequentialGroup()
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 483, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jbtn_distribucionupdate)
                        .addGroup(jPanel11Layout.createSequentialGroup()
                            .addComponent(jLabel40)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_piezasxparupdate, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jtf_actualizadisclave, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(28, Short.MAX_VALUE))
            );
            jPanel11Layout.setVerticalGroup(
                jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel11Layout.createSequentialGroup()
                    .addGap(3, 3, 3)
                    .addComponent(jtf_actualizadisclave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel40)
                        .addComponent(jtf_piezasxparupdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jbtn_distribucionupdate))
            );

            jPanel12.setName("jPanel12"); // NOI18N

            jScrollPane3.setName("jScrollPane3"); // NOI18N

            jtb_distribucion.setModel(this.jtable_modelo_detalledistribucion);
            jtb_distribucion.setName("jtb_distribucion"); // NOI18N
            jtb_distribucion.setRowHeight(23);
            jtb_distribucion.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jtb_distribucionMouseClicked(evt);
                    if(evt.getClickCount() >= 1)
                    {
                        dioclickdis(evt);
                    }
                }
            });
            jScrollPane3.setViewportView(jtb_distribucion);

            javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
            jPanel12.setLayout(jPanel12Layout);
            jPanel12Layout.setHorizontalGroup(
                jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup()
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 1020, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(11, Short.MAX_VALUE))
            );
            jPanel12Layout.setVerticalGroup(
                jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
            );

            jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
            jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
            jbtn_guardar.setToolTipText(resourceMap.getString("jbtn_guardar.toolTipText")); // NOI18N
            jbtn_guardar.setName("jbtn_guardar"); // NOI18N
            jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_guardarActionPerformed(evt);
                }
            });

            jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
            jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
            jbtn_agregar.setToolTipText(resourceMap.getString("jbtn_agregar.toolTipText")); // NOI18N
            jbtn_agregar.setActionCommand(resourceMap.getString("jbtn_agregar.actionCommand")); // NOI18N
            jbtn_agregar.setName("jbtn_agregar"); // NOI18N
            jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_agregarActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jbtn_guardar)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jbtn_agregar)
                    .addContainerGap(50, Short.MAX_VALUE))
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(27, 27, 27)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jbtn_guardar)
                                .addComponent(jbtn_agregar)))))
            );

            jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

            jPanel2.setName("jPanel2"); // NOI18N

            jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel6.border.title"))); // NOI18N
            jPanel6.setName("jPanel6"); // NOI18N

            jScrollPane4.setName("jScrollPane4"); // NOI18N

            jtb_distribucioncontrolinterno.setModel(this.jtable_modelo_detalledistri_interno);
            jtb_distribucioncontrolinterno.setName("jtb_distribucioncontrolinterno"); // NOI18N
            jtb_distribucioncontrolinterno.setRowHeight(22);
            jtb_distribucioncontrolinterno.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    jtb_distribucioncontrolinternoPropertyChange(evt);
                }
            });
            jtb_distribucioncontrolinterno.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jtb_distribucioncontrolinternoKeyPressed(evt);
                }
            });
            jScrollPane4.setViewportView(jtb_distribucioncontrolinterno);

            javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
            jPanel6.setLayout(jPanel6Layout);
            jPanel6Layout.setHorizontalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 632, Short.MAX_VALUE)
            );
            jPanel6Layout.setVerticalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)
            );

            jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel13.border.title"))); // NOI18N
            jPanel13.setName("jPanel13"); // NOI18N

            jScrollPane10.setName("jScrollPane10"); // NOI18N

            jtb_distribucioncontrolinterno2.setModel(this.jtable_modelo_terminaciones);
            jtb_distribucioncontrolinterno2.setName("jtb_distribucioncontrolinterno2"); // NOI18N
            jtb_distribucioncontrolinterno2.setRowHeight(22);
            jtb_distribucioncontrolinterno2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    jtb_distribucioncontrolinterno2PropertyChange(evt);
                }
            });
            jtb_distribucioncontrolinterno2.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jtb_distribucioncontrolinterno2KeyPressed(evt);
                }
            });
            jScrollPane10.setViewportView(jtb_distribucioncontrolinterno2);

            jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
            jButton1.setName("jButton1"); // NOI18N
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
            jPanel13.setLayout(jPanel13Layout);
            jPanel13Layout.setHorizontalGroup(
                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
                .addGroup(jPanel13Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jButton1)
                    .addContainerGap(191, Short.MAX_VALUE))
            );
            jPanel13Layout.setVerticalGroup(
                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup()
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                    .addComponent(jButton1))
            );

            javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
            jPanel2.setLayout(jPanel2Layout);
            jPanel2Layout.setHorizontalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(75, Short.MAX_VALUE))
            );
            jPanel2Layout.setVerticalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(36, Short.MAX_VALUE))
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );

            jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

            jPanel4.setName("jPanel4"); // NOI18N

            jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
            jPanel5.setName("jPanel5"); // NOI18N

            jScrollPane5.setName("jScrollPane5"); // NOI18N

            jta_archivo.setColumns(20);
            jta_archivo.setRows(5);
            jta_archivo.setName("jta_archivo"); // NOI18N
            jScrollPane5.setViewportView(jta_archivo);

            jbtn_importar.setIcon(resourceMap.getIcon("jbtn_importar.icon")); // NOI18N
            jbtn_importar.setText(resourceMap.getString("jbtn_importar.text")); // NOI18N
            jbtn_importar.setToolTipText(resourceMap.getString("jbtn_importar.toolTipText")); // NOI18N
            jbtn_importar.setName("jbtn_importar"); // NOI18N
            jbtn_importar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_importarActionPerformed(evt);
                }
            });

            jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
            jLabel24.setToolTipText(resourceMap.getString("jLabel24.toolTipText")); // NOI18N
            jLabel24.setName("jLabel24"); // NOI18N

            jScrollPane6.setName("jScrollPane6"); // NOI18N

            jlst_clientesdistribucion.setModel(this.modelo);
            jlst_clientesdistribucion.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jlst_clientesdistribucion.setName("jlst_clientesdistribucion"); // NOI18N
            jlst_clientesdistribucion.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jlst_clientesdistribucionMouseClicked(evt);
                    if(evt.getClickCount() >= 1)
                    {
                        dioclick(evt);
                    }
                }
            });
            jScrollPane6.setViewportView(jlst_clientesdistribucion);

            jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
            jLabel9.setName("jLabel9"); // NOI18N

            jtf_tiendaactual.setEditable(false);
            jtf_tiendaactual.setText(resourceMap.getString("jtf_tiendaactual.text")); // NOI18N
            jtf_tiendaactual.setName("jtf_tiendaactual"); // NOI18N

            jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
            jLabel15.setName("jLabel15"); // NOI18N

            jtf_viajedescribe.setText(resourceMap.getString("jtf_viajedescribe.text")); // NOI18N
            jtf_viajedescribe.setName("jtf_viajedescribe"); // NOI18N
            jtf_viajedescribe.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_viajedescribeActionPerformed(evt);
                }
            });

            jbtn_crearviaje.setIcon(resourceMap.getIcon("jbtn_crearviaje.icon")); // NOI18N
            jbtn_crearviaje.setText(resourceMap.getString("jbtn_crearviaje.text")); // NOI18N
            jbtn_crearviaje.setToolTipText(resourceMap.getString("jbtn_crearviaje.toolTipText")); // NOI18N
            jbtn_crearviaje.setName("jbtn_crearviaje"); // NOI18N
            jbtn_crearviaje.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_crearviajeActionPerformed(evt);
                }
            });

            jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
            jLabel16.setName("jLabel16"); // NOI18N

            jtf_viajeobservaciones.setText(resourceMap.getString("jtf_viajeobservaciones.text")); // NOI18N
            jtf_viajeobservaciones.setName("jtf_viajeobservaciones"); // NOI18N
            jtf_viajeobservaciones.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_viajeobservacionesActionPerformed(evt);
                }
            });

            jtf_viajeinicial.setFont(resourceMap.getFont("jtf_viajeinicial.font")); // NOI18N
            jtf_viajeinicial.setText(resourceMap.getString("jtf_viajeinicial.text")); // NOI18N
            jtf_viajeinicial.setToolTipText(resourceMap.getString("jtf_viajeinicial.toolTipText")); // NOI18N
            jtf_viajeinicial.setName("jtf_viajeinicial"); // NOI18N
            jtf_viajeinicial.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_viajeinicialActionPerformed(evt);
                }
            });

            jLabel37.setText(resourceMap.getString("jLabel37.text")); // NOI18N
            jLabel37.setName("jLabel37"); // NOI18N

            jLabel41.setText(resourceMap.getString("jLabel41.text")); // NOI18N
            jLabel41.setName("jLabel41"); // NOI18N

            jbtn_importar1.setIcon(resourceMap.getIcon("jbtn_importar1.icon")); // NOI18N
            jbtn_importar1.setText(resourceMap.getString("jbtn_importar1.text")); // NOI18N
            jbtn_importar1.setToolTipText(resourceMap.getString("jbtn_importar1.toolTipText")); // NOI18N
            jbtn_importar1.setName("jbtn_importar1"); // NOI18N
            jbtn_importar1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_importar1ActionPerformed(evt);
                }
            });

            jLabel45.setText(resourceMap.getString("jLabel45.text")); // NOI18N
            jLabel45.setToolTipText(resourceMap.getString("jLabel45.toolTipText")); // NOI18N
            jLabel45.setName("jLabel45"); // NOI18N

            jbtn_importar2.setIcon(resourceMap.getIcon("jbtn_importar2.icon")); // NOI18N
            jbtn_importar2.setText(resourceMap.getString("jbtn_importar2.text")); // NOI18N
            jbtn_importar2.setToolTipText(resourceMap.getString("jbtn_importar2.toolTipText")); // NOI18N
            jbtn_importar2.setName("jbtn_importar2"); // NOI18N
            jbtn_importar2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_importar2ActionPerformed(evt);
                }
            });

            jbtn_importar3.setText(resourceMap.getString("jbtn_importar3.text")); // NOI18N
            jbtn_importar3.setToolTipText(resourceMap.getString("jbtn_importar3.toolTipText")); // NOI18N
            jbtn_importar3.setName("jbtn_importar3"); // NOI18N
            jbtn_importar3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_importar3ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
            jPanel5.setLayout(jPanel5Layout);
            jPanel5Layout.setHorizontalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel9)
                                .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 884, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jLabel15)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_viajedescribe, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 78, Short.MAX_VALUE)
                            .addComponent(jLabel37)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jtf_viajeinicial, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel16)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_viajeobservaciones, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jbtn_crearviaje)
                            .addGap(194, 194, 194))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jtf_tiendaactual, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jbtn_importar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGap(18, 18, 18)
                            .addComponent(jbtn_importar)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel45)
                                .addGroup(jPanel5Layout.createSequentialGroup()
                                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel24)
                                        .addComponent(jLabel41))
                                    .addGap(82, 82, 82)
                                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jbtn_importar3)
                                        .addComponent(jbtn_importar2))))
                            .addGap(272, 272, 272))))
            );
            jPanel5Layout.setVerticalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel15)
                        .addComponent(jtf_viajedescribe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_crearviaje)
                        .addComponent(jtf_viajeobservaciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16)
                        .addComponent(jtf_viajeinicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel37))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel9)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_tiendaactual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtn_importar1)
                            .addComponent(jbtn_importar))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel24)
                                .addComponent(jbtn_importar2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel45)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel41)
                                .addComponent(jbtn_importar3))))
                    .addGap(53, 53, 53))
            );

            jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel14.border.title"))); // NOI18N
            jPanel14.setName("jPanel14"); // NOI18N

            jLabel42.setText(resourceMap.getString("jLabel42.text")); // NOI18N
            jLabel42.setName("jLabel42"); // NOI18N

            jtf_observa_update.setName("jtf_observa_update"); // NOI18N

            jbtn_actualizar.setIcon(resourceMap.getIcon("jbtn_actualizar.icon")); // NOI18N
            jbtn_actualizar.setText(resourceMap.getString("jbtn_actualizar.text")); // NOI18N
            jbtn_actualizar.setToolTipText(resourceMap.getString("jbtn_actualizar.toolTipText")); // NOI18N
            jbtn_actualizar.setName("jbtn_actualizar"); // NOI18N
            jbtn_actualizar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_actualizarActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
            jPanel14.setLayout(jPanel14Layout);
            jPanel14Layout.setHorizontalGroup(
                jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup()
                    .addComponent(jLabel42)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_observa_update, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jbtn_actualizar)
                    .addGap(320, 320, 320))
            );
            jPanel14Layout.setVerticalGroup(
                jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel42)
                        .addComponent(jtf_observa_update, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_actualizar))
                    .addContainerGap(25, Short.MAX_VALUE))
            );

            javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
            jPanel4.setLayout(jPanel4Layout);
            jPanel4Layout.setHorizontalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 1024, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap())
            );
            jPanel4Layout.setVerticalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            );

            jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

            jPanel8.setName("jPanel8"); // NOI18N

            jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel7.border.title"))); // NOI18N
            jPanel7.setName("jPanel7"); // NOI18N

            jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
            jLabel17.setName("jLabel17"); // NOI18N

            jtf_idarticulo.setToolTipText(resourceMap.getString("jtf_idarticulo.toolTipText")); // NOI18N
            jtf_idarticulo.setName("jtf_idarticulo"); // NOI18N
            jtf_idarticulo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_idarticuloActionPerformed(evt);
                }
            });

            jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
            jLabel18.setName("jLabel18"); // NOI18N

            jtf_insumodescripcion.setToolTipText(resourceMap.getString("jtf_insumodescripcion.toolTipText")); // NOI18N
            jtf_insumodescripcion.setName("jtf_insumodescripcion"); // NOI18N
            jtf_insumodescripcion.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_insumodescripcionActionPerformed(evt);
                }
            });

            jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
            jLabel20.setName("jLabel20"); // NOI18N

            jtf_clavedescor.setToolTipText(resourceMap.getString("jtf_clavedescor.toolTipText")); // NOI18N
            jtf_clavedescor.setName("jtf_clavedescor"); // NOI18N
            jtf_clavedescor.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_clavedescorActionPerformed(evt);
                }
            });

            jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
            jLabel21.setName("jLabel21"); // NOI18N

            jtf_unidadsal.setText(resourceMap.getString("jtf_unidadsal.text")); // NOI18N
            jtf_unidadsal.setName("jtf_unidadsal"); // NOI18N
            jtf_unidadsal.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_unidadsalActionPerformed(evt);
                }
            });

            jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
            jLabel23.setName("jLabel23"); // NOI18N

            jtf_costo.setText(resourceMap.getString("jtf_costo.text")); // NOI18N
            jtf_costo.setName("jtf_costo"); // NOI18N
            jtf_costo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_costoActionPerformed(evt);
                }
            });

            jlbl_costo2.setText(resourceMap.getString("jlbl_costo2.text")); // NOI18N
            jlbl_costo2.setName("jlbl_costo2"); // NOI18N

            jtf_itemprov.setName("jtf_itemprov"); // NOI18N
            jtf_itemprov.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_itemprovActionPerformed(evt);
                }
            });

            jlbl_costo3.setText(resourceMap.getString("jlbl_costo3.text")); // NOI18N
            jlbl_costo3.setName("jlbl_costo3"); // NOI18N

            jtf_itemderi.setName("jtf_itemderi"); // NOI18N
            jtf_itemderi.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_itemderiActionPerformed(evt);
                }
            });

            jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
            jLabel25.setName("jLabel25"); // NOI18N

            jtf_contruirinip.setText(resourceMap.getString("jtf_contruirinip.text")); // NOI18N
            jtf_contruirinip.setToolTipText(resourceMap.getString("jtf_contruirinip.toolTipText")); // NOI18N
            jtf_contruirinip.setName("jtf_contruirinip"); // NOI18N
            jtf_contruirinip.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_contruirinipActionPerformed(evt);
                }
            });

            jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
            jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
            jbtn_buscar.setName("jbtn_buscar"); // NOI18N
            jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_buscarActionPerformed(evt);
                }
            });

            jtf_claveiv.setText(resourceMap.getString("jtf_claveiv.text")); // NOI18N
            jtf_claveiv.setToolTipText(resourceMap.getString("jtf_claveiv.toolTipText")); // NOI18N
            jtf_claveiv.setName("jtf_claveiv"); // NOI18N
            jtf_claveiv.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_claveivActionPerformed(evt);
                }
            });

            jtf_clavetc.setText(resourceMap.getString("jtf_clavetc.text")); // NOI18N
            jtf_clavetc.setToolTipText(resourceMap.getString("jtf_clavetc.toolTipText")); // NOI18N
            jtf_clavetc.setName("jtf_clavetc"); // NOI18N
            jtf_clavetc.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_clavetcActionPerformed(evt);
                }
            });

            jcbx_familia.setName("jcbx_familia"); // NOI18N
            jcbx_familia.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcbx_familiaActionPerformed(evt);
                }
            });

            jLabel30.setText(resourceMap.getString("jLabel30.text")); // NOI18N
            jLabel30.setName("jLabel30"); // NOI18N

            jcbx_iddescricorta.setName("jcbx_iddescricorta"); // NOI18N
            jcbx_iddescricorta.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcbx_iddescricortaActionPerformed(evt);
                }
            });

            jLabel31.setText(resourceMap.getString("jLabel31.text")); // NOI18N
            jLabel31.setName("jLabel31"); // NOI18N

            jcbx_clavemes.setName("jcbx_clavemes"); // NOI18N
            jcbx_clavemes.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcbx_clavemesActionPerformed(evt);
                }
            });

            jcbx_claveyear.setName("jcbx_claveyear"); // NOI18N
            jcbx_claveyear.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcbx_claveyearActionPerformed(evt);
                }
            });

            jLabel32.setText(resourceMap.getString("jLabel32.text")); // NOI18N
            jLabel32.setName("jLabel32"); // NOI18N

            jLabel33.setText(resourceMap.getString("jLabel33.text")); // NOI18N
            jLabel33.setName("jLabel33"); // NOI18N

            jLabel34.setText(resourceMap.getString("jLabel34.text")); // NOI18N
            jLabel34.setName("jLabel34"); // NOI18N

            jLabel35.setText(resourceMap.getString("jLabel35.text")); // NOI18N
            jLabel35.setName("jLabel35"); // NOI18N

            jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
            jLabel26.setName("jLabel26"); // NOI18N

            jtf_precioventa.setText(resourceMap.getString("jtf_precioventa.text")); // NOI18N
            jtf_precioventa.setToolTipText(resourceMap.getString("jtf_precioventa.toolTipText")); // NOI18N
            jtf_precioventa.setName("jtf_precioventa"); // NOI18N
            jtf_precioventa.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_precioventaActionPerformed(evt);
                }
            });

            jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
            jLabel27.setName("jLabel27"); // NOI18N

            jtf_clavecantidad.setText(resourceMap.getString("jtf_clavecantidad.text")); // NOI18N
            jtf_clavecantidad.setName("jtf_clavecantidad"); // NOI18N
            jtf_clavecantidad.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_clavecantidadActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
            jPanel7.setLayout(jPanel7Layout);
            jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel18)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlbl_costo2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_itemprov, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlbl_costo3)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_itemderi, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel21)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel23)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_costo, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel26)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_precioventa, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel27)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_clavecantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(170, 170, 170))
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel7Layout.createSequentialGroup()
                            .addComponent(jLabel25)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_contruirinip, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel30)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jcbx_familia, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jcbx_iddescricorta, 0, 114, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(jPanel7Layout.createSequentialGroup()
                            .addComponent(jLabel17)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_idarticulo, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jbtn_buscar, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                            .addGap(32, 32, 32)))
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel7Layout.createSequentialGroup()
                            .addComponent(jLabel20)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_clavedescor, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel7Layout.createSequentialGroup()
                            .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jcbx_clavemes, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jcbx_claveyear, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jtf_claveiv, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_clavetc, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(304, 304, 304))
            );
            jPanel7Layout.setVerticalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel25)
                        .addComponent(jtf_contruirinip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jcbx_familia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel30)
                        .addComponent(jcbx_iddescricorta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel31)
                        .addComponent(jcbx_clavemes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jcbx_claveyear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel32)
                        .addComponent(jLabel33)
                        .addComponent(jLabel34)
                        .addComponent(jtf_claveiv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel35)
                        .addComponent(jtf_clavetc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel17)
                        .addComponent(jtf_idarticulo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel20)
                        .addComponent(jtf_clavedescor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_buscar))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel18)
                        .addComponent(jtf_insumodescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl_costo2)
                        .addComponent(jtf_itemprov, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel27)
                        .addComponent(jtf_clavecantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel26)
                        .addComponent(jtf_precioventa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel23)
                        .addComponent(jtf_costo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_unidadsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel21)
                        .addComponent(jlbl_costo3)
                        .addComponent(jtf_itemderi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            );

            jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel10.border.title"))); // NOI18N
            jPanel10.setName("jPanel10"); // NOI18N

            jScrollPane7.setName("jScrollPane7"); // NOI18N

            jtb_distribucionalta.setModel(this.jtable_modelo_detalledistri_ingresa);
            jtb_distribucionalta.setName("jtb_distribucionalta"); // NOI18N
            jtb_distribucionalta.setRowHeight(22);
            jtb_distribucionalta.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    jtb_distribucionaltaPropertyChange(evt);
                }
            });
            jtb_distribucionalta.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jtb_distribucionaltaKeyPressed(evt);
                }
            });
            jScrollPane7.setViewportView(jtb_distribucionalta);

            jtf_distritotalpz.setEditable(false);
            jtf_distritotalpz.setText(resourceMap.getString("jtf_distritotalpz.text")); // NOI18N
            jtf_distritotalpz.setToolTipText(resourceMap.getString("jtf_distritotalpz.toolTipText")); // NOI18N
            jtf_distritotalpz.setName("jtf_distritotalpz"); // NOI18N
            jtf_distritotalpz.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_distritotalpzActionPerformed(evt);
                }
            });

            jLabel38.setText(resourceMap.getString("jLabel38.text")); // NOI18N
            jLabel38.setName("jLabel38"); // NOI18N

            jbtn_agregardistribucionprevia.setIcon(resourceMap.getIcon("jbtn_agregardistribucionprevia.icon")); // NOI18N
            jbtn_agregardistribucionprevia.setText(resourceMap.getString("jbtn_agregardistribucionprevia.text")); // NOI18N
            jbtn_agregardistribucionprevia.setToolTipText(resourceMap.getString("jbtn_agregardistribucionprevia.toolTipText")); // NOI18N
            jbtn_agregardistribucionprevia.setName("jbtn_agregardistribucionprevia"); // NOI18N
            jbtn_agregardistribucionprevia.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_agregardistribucionpreviaActionPerformed(evt);
                }
            });

            jtf_distripzfal.setText(resourceMap.getString("jtf_distripzfal.text")); // NOI18N
            jtf_distripzfal.setToolTipText(resourceMap.getString("jtf_distripzfal.toolTipText")); // NOI18N
            jtf_distripzfal.setName("jtf_distripzfal"); // NOI18N
            jtf_distripzfal.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_distripzfalActionPerformed(evt);
                }
            });

            jLabel29.setText(resourceMap.getString("jLabel29.text")); // NOI18N
            jLabel29.setName("jLabel29"); // NOI18N

            jtf_distripzsob.setText(resourceMap.getString("jtf_distripzsob.text")); // NOI18N
            jtf_distripzsob.setToolTipText(resourceMap.getString("jtf_distripzsob.toolTipText")); // NOI18N
            jtf_distripzsob.setName("jtf_distripzsob"); // NOI18N
            jtf_distripzsob.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_distripzsobActionPerformed(evt);
                }
            });

            jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
            jLabel22.setName("jLabel22"); // NOI18N

            jtf_distripzxtie.setText(resourceMap.getString("jtf_distripzxtie.text")); // NOI18N
            jtf_distripzxtie.setToolTipText(resourceMap.getString("jtf_distripzxtie.toolTipText")); // NOI18N
            jtf_distripzxtie.setName("jtf_distripzxtie"); // NOI18N
            jtf_distripzxtie.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_distripzxtieActionPerformed(evt);
                }
            });

            jLabel28.setText(resourceMap.getString("jLabel28.text")); // NOI18N
            jLabel28.setName("jLabel28"); // NOI18N

            jLabel36.setText(resourceMap.getString("jLabel36.text")); // NOI18N
            jLabel36.setName("jLabel36"); // NOI18N

            jtf_distripzalma.setText(resourceMap.getString("jtf_distripzalma.text")); // NOI18N
            jtf_distripzalma.setToolTipText(resourceMap.getString("jtf_distripzalma.toolTipText")); // NOI18N
            jtf_distripzalma.setName("jtf_distripzalma"); // NOI18N
            jtf_distripzalma.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_distripzalmaActionPerformed(evt);
                }
            });

            jbtn_agregapartidalocal.setIcon(resourceMap.getIcon("jbtn_agregapartidalocal.icon")); // NOI18N
            jbtn_agregapartidalocal.setText(resourceMap.getString("jbtn_agregapartidalocal.text")); // NOI18N
            jbtn_agregapartidalocal.setName("jbtn_agregapartidalocal"); // NOI18N
            jbtn_agregapartidalocal.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_agregapartidalocalActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
            jPanel10.setLayout(jPanel10Layout);
            jPanel10Layout.setHorizontalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addComponent(jLabel22)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jtf_distripzxtie, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addComponent(jLabel36)
                                    .addGap(18, 18, 18)
                                    .addComponent(jtf_distripzsob, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel28)
                                        .addComponent(jLabel29))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jtf_distripzfal, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jtf_distripzalma, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jbtn_agregardistribucionprevia)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(jbtn_agregapartidalocal)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jLabel38)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_distritotalpz, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(587, Short.MAX_VALUE))
            );
            jPanel10Layout.setVerticalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel22)
                                .addComponent(jtf_distripzxtie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel28)
                                .addComponent(jtf_distripzalma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(22, 22, 22)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel29)
                                .addComponent(jtf_distripzfal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel36)
                                .addComponent(jtf_distripzsob, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(28, 28, 28)
                            .addComponent(jbtn_agregardistribucionprevia)
                            .addGap(13, 13, 13)
                            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jbtn_agregapartidalocal)
                                .addComponent(jLabel38)
                                .addComponent(jtf_distritotalpz, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );

            javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
            jPanel8.setLayout(jPanel8Layout);
            jPanel8Layout.setHorizontalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap())
            );
            jPanel8Layout.setVerticalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(44, Short.MAX_VALUE))
            );

            jTabbedPane1.addTab(resourceMap.getString("jPanel8.TabConstraints.tabTitle"), jPanel8); // NOI18N

            jPanel15.setName("jPanel15"); // NOI18N

            jScrollPane11.setName("jScrollPane11"); // NOI18N

            jtbl_recepciones.setModel(this.jtable_modelo);
            jtbl_recepciones.setName("jtbl_recepciones"); // NOI18N
            jtbl_recepciones.setRowHeight(22);
            jtbl_recepciones.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jtbl_recepcionesMouseClicked(evt);
                    if(evt.getClickCount() >= 2)
                    {
                        dioclickr(evt);
                    }
                    if(evt.getClickCount() == 1)
                    {
                        dioclickgenven(evt);
                    }
                }
            });
            jScrollPane11.setViewportView(jtbl_recepciones);

            jbtn_cargardistribucionxclie.setIcon(resourceMap.getIcon("jbtn_cargardistribucionxclie.icon")); // NOI18N
            jbtn_cargardistribucionxclie.setText(resourceMap.getString("jbtn_cargardistribucionxclie.text")); // NOI18N
            jbtn_cargardistribucionxclie.setName("jbtn_cargardistribucionxclie"); // NOI18N
            jbtn_cargardistribucionxclie.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_cargardistribucionxclieActionPerformed(evt);
                }
            });

            jtf_idffila.setEditable(false);
            jtf_idffila.setName("jtf_idffila"); // NOI18N

            jtf_idcliente.setEditable(false);
            jtf_idcliente.setName("jtf_idcliente"); // NOI18N

            jtf_describecliente.setEditable(false);
            jtf_describecliente.setName("jtf_describecliente"); // NOI18N

            jtf_pzasdistri.setEditable(false);
            jtf_pzasdistri.setName("jtf_pzasdistri"); // NOI18N

            jbtn_generarventa.setIcon(resourceMap.getIcon("jbtn_generarventa.icon")); // NOI18N
            jbtn_generarventa.setText(resourceMap.getString("jbtn_generarventa.text")); // NOI18N
            jbtn_generarventa.setName("jbtn_generarventa"); // NOI18N
            jbtn_generarventa.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_generarventaActionPerformed(evt);
                }
            });

            jbtn_generarventa1.setIcon(resourceMap.getIcon("jbtn_generarventa1.icon")); // NOI18N
            jbtn_generarventa1.setText(resourceMap.getString("jbtn_generarventa1.text")); // NOI18N
            jbtn_generarventa1.setName("jbtn_generarventa1"); // NOI18N
            jbtn_generarventa1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_generarventa1ActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
            jPanel15.setLayout(jPanel15Layout);
            jPanel15Layout.setHorizontalGroup(
                jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel15Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jbtn_cargardistribucionxclie)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_idffila, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jtf_idcliente, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_describecliente, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jtf_pzasdistri, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jbtn_generarventa)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
                    .addComponent(jbtn_generarventa1)
                    .addGap(48, 48, 48))
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 1022, Short.MAX_VALUE)
                        .addGap(5, 5, 5)))
            );
            jPanel15Layout.setVerticalGroup(
                jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup()
                    .addContainerGap(411, Short.MAX_VALUE)
                    .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jbtn_cargardistribucionxclie)
                        .addComponent(jtf_idffila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_idcliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_describecliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_pzasdistri, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jbtn_generarventa)
                        .addComponent(jbtn_generarventa1))
                    .addGap(31, 31, 31))
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addGap(105, 105, 105)
                        .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(105, Short.MAX_VALUE)))
            );

            jTabbedPane1.addTab(resourceMap.getString("jPanel15.TabConstraints.tabTitle"), jPanel15); // NOI18N

            jMenuBar1.setName("jMenuBar1"); // NOI18N

            jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
            jMenu1.setName("jMenu1"); // NOI18N

            jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
            jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
            jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
            jmni_salir.setName("jmni_salir"); // NOI18N
            jmni_salir.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_salirActionPerformed(evt);
                }
            });
            jMenu1.add(jmni_salir);

            jmni_salirsinguardar.setText(resourceMap.getString("jmni_salirsinguardar.text")); // NOI18N
            jmni_salirsinguardar.setName("jmni_salirsinguardar"); // NOI18N
            jmni_salirsinguardar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_salirsinguardarActionPerformed(evt);
                }
            });
            jMenu1.add(jmni_salirsinguardar);

            jMenuBar1.add(jMenu1);

            jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
            jMenu2.setName("jMenu2"); // NOI18N
            jMenu2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenu2ActionPerformed(evt);
                }
            });

            jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
            jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
            jmni_escape.setName("jmni_escape"); // NOI18N
            jmni_escape.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_escapeActionPerformed(evt);
                }
            });
            jMenu2.add(jmni_escape);

            jckbx_redondear.setText(resourceMap.getString("jckbx_redondear.text")); // NOI18N
            jckbx_redondear.setName("jckbx_redondear"); // NOI18N
            jckbx_redondear.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jckbx_redondearActionPerformed(evt);
                }
            });
            jMenu2.add(jckbx_redondear);

            jckbx_simularred.setText(resourceMap.getString("jckbx_simularred.text")); // NOI18N
            jckbx_simularred.setName("jckbx_simularred"); // NOI18N
            jckbx_simularred.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jckbx_simularredActionPerformed(evt);
                }
            });
            jMenu2.add(jckbx_simularred);

            jmni_limpiardocto.setText(resourceMap.getString("jmni_limpiardocto.text")); // NOI18N
            jmni_limpiardocto.setName("jmni_limpiardocto"); // NOI18N
            jmni_limpiardocto.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_limpiardoctoActionPerformed(evt);
                }
            });
            jMenu2.add(jmni_limpiardocto);

            jmni_altaprovee.setText(resourceMap.getString("jmni_altaprovee.text")); // NOI18N
            jmni_altaprovee.setName("jmni_altaprovee"); // NOI18N
            jmni_altaprovee.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_altaproveeActionPerformed(evt);
                }
            });
            jMenu2.add(jmni_altaprovee);

            jmni_guardar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
            jmni_guardar.setText(resourceMap.getString("jmni_guardar.text")); // NOI18N
            jmni_guardar.setName("jmni_guardar"); // NOI18N
            jmni_guardar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jmni_guardarActionPerformed(evt);
                }
            });
            jMenu2.add(jmni_guardar);

            jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
            jMenuItem1.setIcon(resourceMap.getIcon("jMenuItem1.icon")); // NOI18N
            jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
            jMenuItem1.setName("jMenuItem1"); // NOI18N
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem1ActionPerformed(evt);
                }
            });
            jMenu2.add(jMenuItem1);

            jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
            jMenuItem2.setName("jMenuItem2"); // NOI18N
            jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem2ActionPerformed(evt);
                }
            });
            jMenu2.add(jMenuItem2);

            jMenuBar1.add(jMenu2);

            setJMenuBar(jMenuBar1);

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1036, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
                    .addContainerGap())
            );

            pack();
        }// </editor-fold>//GEN-END:initComponents

    private void jtf_idproveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idproveedorActionPerformed
        // TODO add yourcarga_datos_proveedor handling code here:
        this.carga_datos_proveedor(1, this.jtf_idproveedor.getText().toUpperCase().trim());
        //this.carga_datos_claveterminacion(1,this.jtf_idproveedor.getText().toUpperCase());
        this.clave_concatenar(2);
        this.jTabbedPane1.setSelectedIndex(4);
}//GEN-LAST:event_jtf_idproveedorActionPerformed

    private void tf_foliodoctoanteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_foliodoctoanteriorActionPerformed
        // TODO add your handling code here:
        this.jtf_descuento.requestFocus();
}//GEN-LAST:event_tf_foliodoctoanteriorActionPerformed

    private void jtf_impuestoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_impuestoActionPerformed
        // TODO add your handling code here:
           int numerofilas=this.jtable_modelo_detallecompra.getRowCount(),error=0;
          for(int i = 0 ;i < numerofilas; i++)
                {
                    jtable_modelo_detallecompra.setValueAt(this.jtf_impuesto.getText().toString(),i,11);
                }
         this.calcularimportes();
         this.calcular_costoi();
         this.jtf_idproveedor.requestFocus();
}//GEN-LAST:event_jtf_impuestoActionPerformed

    private void jtf_descuentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_descuentoActionPerformed
        // TODO add your handling code here:
         int numerofilas=this.jtable_modelo_detallecompra.getRowCount(),error=0;
          for(int i = 0 ;i < numerofilas; i++)
                {
                    jtable_modelo_detallecompra.setValueAt(this.jtf_descuento.getText().toString(),i,10);
                }
         this.calcularimportes();
         this.jtf_impuesto.requestFocus();
}//GEN-LAST:event_jtf_descuentoActionPerformed

    private void jtf_describeproveedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_describeproveedorActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_describeproveedorActionPerformed

    private void jcmbx_clasifviajeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcmbx_clasifviajeActionPerformed
        // TODO add your handling code here:
        
        if  (controlcargo>0)
        {
        String arreglo_viaje[]=this.jcmbx_clasifviaje.getSelectedItem().toString().split(":");
        this.jtf_claveiv.setText(arreglo_viaje[1]);
        this.clave_concatenar(0);
        }
        this.tf_foliodoctoanterior.requestFocus();
        
}//GEN-LAST:event_jcmbx_clasifviajeActionPerformed

    private void jtb_terminadosentradaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_terminadosentradaPropertyChange
        // TODO add your handling code here:
         this.calcularimportes();
         this.calcular_costoi();
}//GEN-LAST:event_jtb_terminadosentradaPropertyChange

    private void jtb_terminadosentradaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_terminadosentradaKeyPressed
        // TODO add your handling code here:
        System.out.println(evt.getKeyCode());
        System.out.println("Hola");
        if (evt.getKeyCode() == 10)
            {
                try
                    {
                    // this.calcularimportes();
                    }
                catch (Exception ex)
                    {
                        System.out.println("ERROR no ha elegido en el cuadro de texto");
                    }
            }
}//GEN-LAST:event_jtb_terminadosentradaKeyPressed

    private void jtb_distribucioncontrolinternoPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinternoPropertyChange
        // TODO add your handling code here:
}//GEN-LAST:event_jtb_distribucioncontrolinternoPropertyChange

    private void jtb_distribucioncontrolinternoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinternoKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jtb_distribucioncontrolinternoKeyPressed

    private void jbtn_importarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "<html><body>Desea Importar Estos Articulos a tienda:<br><b><h2>"+this.jtf_tiendaactual.getText()+"?</h2></b></body></html>")==0)
            {
            if (sihaytotal==1)
                {
                    this.jtable_modelo_detalledistribucion.removeRow(jtable_modelo_detalledistribucion.getRowCount()-1);
                }
            String idclientearre[]=this.jtf_tiendaactual.getText().split(":");
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            int columnatienda=this.findcolumna_idtienda(idclientearre[0]);
             for (int i=0;i<arreglo_importa.length;i++)
             {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.crea_hoja_distribucionalmacen(arreglo_codigo, idclientearre[0], columnatienda);
                //this.jtf_anchomaterial.setText(arreglo_codigo[0]);
                //this.jtf_idinsumo.setText(arreglo_codigo[1]);
                //this.jtf_canpzaingresa.setText(arreglo_codigo[2]);
                //this.jtf_pzasreferencia.setText(arreglo_codigo[3]);
                //this.jtf_segundos.setText(arreglo_codigo[4]);
                //this.jtf_precioinsimo.setText(arreglo_codigo[5]);
                //this.calcularcortexpieza();
                //this.jbtn_buscarActionPerformed(evt);
               
            }
     this.contruir_totales_distribucionalma();
     this.calcularimportes();
     this.calcular_costoi();
     hayregistros=1;
     this.jta_archivo.setText("");
            //this.jtf_canpzaingresa.setText("0");
            //this.jtf_idinsumo.setText("");
            //this.jtf_idinsumo.requestFocus();

        }
}//GEN-LAST:event_jbtn_importarActionPerformed


    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
    if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
        {
            if(hayregistros==0)
                    {
                        this.dispose();
                    }
            else
                    {
                        JOptionPane.showMessageDialog(null,"Existen Registros sin Guardar, Por favor Verifique o en el Menu Archivo Elija Salir sin Guardar", "Sistema Integral(Alta Compras) : Error",1);
                    }
        }
}//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:
        float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
       // int index=this.jcmbx_tiendaclie.getSelectedIndex();

         String arreglo_viaje[]=this.jcmbx_clasifviaje.getSelectedItem().toString().split(":");
        if ((Integer.valueOf(arreglo_viaje[0])>0)  && (controlpro==1) && (tpiezas>0)) {
            this.documento_guardar(1,2);
            //this.carga_datos_claveterminacion(3, this.jtf_idproveedor.getText(),this.jtf_clavetc.getText());
            //hayregistros=0;
            //System.out.println("se guarda");
            this.dispose();
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar Viaje,Proveedor etc", "Sistema Integral(Agregar Produccion) : Error",1);
        }
}//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jbtn_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_salirActionPerformed
        // TODO add your handling code here:
        //x.cierraConexion();
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0) {
            this.dispose();
        }
}//GEN-LAST:event_jbtn_salirActionPerformed

    private void jbtn_helpayudameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_helpayudameActionPerformed
        // TODO add your handling code here:
        //  this.ayuda();
}//GEN-LAST:event_jbtn_helpayudameActionPerformed

    private void jckbx_redondearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jckbx_redondearActionPerformed
        // TODO add your handling code here:
        this.calcularimportes_red();
    }//GEN-LAST:event_jckbx_redondearActionPerformed

    private void jckbx_simularredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jckbx_simularredActionPerformed
        // TODO add your handling code here:
        this.calcularimportes_redsim();
    }//GEN-LAST:event_jckbx_simularredActionPerformed

    private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
        // TODO add your handling code here:
        this.jtf_idproveedorActionPerformed(evt);
    }//GEN-LAST:event_jCheckBox1ActionPerformed

    private void jmni_limpiardoctoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_limpiardoctoActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Limpiar Documento?")==0)
        {
            this.Limpiar_compra();
        }

    }//GEN-LAST:event_jmni_limpiardoctoActionPerformed

    private void jtf_viajedescribeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_viajedescribeActionPerformed
        // TODO add your handling code here:
        this.jtf_viajeinicial.requestFocus();

    }//GEN-LAST:event_jtf_viajedescribeActionPerformed

    private void jtf_viajeobservacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_viajeobservacionesActionPerformed
        // TODO add your handling code here:
        this.jbtn_crearviaje.requestFocus();
    }//GEN-LAST:event_jtf_viajeobservacionesActionPerformed

    private void jbtn_crearviajeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_crearviajeActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos los Datos?")==0)
        {
         int folio=0;
         String textosql="select * from x1distribucion_terminados_viajes_actualiza(3,'','"+this.jtf_viajedescribe.getText().toUpperCase().trim()+"','','','"+this.jtf_viajeobservaciones.getText().toUpperCase().trim()+"','"+this.jtf_viajeinicial.getText().toUpperCase().trim()+"');";
         try {
            rs = x.sieuno_executediversosv2(textosql,variables_global.getconexiongral());
            while (rs.next())
                {
                folio = rs.getInt(1);
                
                }
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
         if (folio==2)
                      {
                        JOptionPane.showMessageDialog(null,"Gracias Viaje Guardado, Si desea Modificarlo visite el Modulo de Viajes", "Sistema Integral: Viajes",1);
                        this.jtf_viajedescribe.setText("");
                        controlcargo=0; //desabilito que pueda concatenar claves
                        this.loadcom_clasifoviajes();
                        controlcargo=1; //habilito el control de claves
                      }
                else
                      {
                        JOptionPane.showMessageDialog(null,"Error Verifiqu con Administrador no se ha podido guardar", "Sistema Integral Error",1);
                      }
        }

    }//GEN-LAST:event_jbtn_crearviajeActionPerformed

    private void jtf_idarticuloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idarticuloActionPerformed
        // TODO add your handling code here:
        this.jtf_insumodescripcion.requestFocus();
}//GEN-LAST:event_jtf_idarticuloActionPerformed

    private void jtf_insumodescripcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_insumodescripcionActionPerformed
        // TODO add your handling code here:
        this.jtf_clavedescor.requestFocus();
}//GEN-LAST:event_jtf_insumodescripcionActionPerformed

    private void jtf_clavedescorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_clavedescorActionPerformed
        // TODO add your handling code here:

        this.jtf_itemprov.requestFocus();
}//GEN-LAST:event_jtf_clavedescorActionPerformed

    private void jtf_unidadsalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_unidadsalActionPerformed
        // TODO add your handling code here:
       this.jtf_costo.requestFocus();
}//GEN-LAST:event_jtf_unidadsalActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
        float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
       // int index=this.jcmbx_tiendaclie.getSelectedIndex();
        int indexope=this.jcmbx_clasifviaje.getSelectedIndex();
        if ((indexope>0)  && (controlpro==1) && (tpiezas>0)) {
            this.documento_guardar(1,1);
            this.carga_datos_claveterminacion(3, this.jtf_idproveedor.getText(),this.jtf_clavetc.getText());
            hayregistros=0;
            System.out.println("se guarda");
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar Viaje,Proveedor etc", "Sistema Integral(Agregar Produccion) : Error",1);
        }
}//GEN-LAST:event_jbtn_agregarActionPerformed

    private void jtf_itemprovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_itemprovActionPerformed
        // TODO add your handling code here:
        this.jtf_itemderi.setText(this.jtf_itemprov.getText().replace("-", ""));
        this.jtf_itemderi.requestFocus();
}//GEN-LAST:event_jtf_itemprovActionPerformed

    private void jtf_itemderiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_itemderiActionPerformed
        // TODO add your handling code here:
        this.jtf_unidadsal.requestFocus();
        
}//GEN-LAST:event_jtf_itemderiActionPerformed

    private void jtf_contruirinipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_contruirinipActionPerformed
        // TODO add your handling code here:
        this.clave_concatenar(3);
}//GEN-LAST:event_jtf_contruirinipActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        String minu="",cantidadarreglo="",codigoi="";
        //minu=this.jtf_minutosaprox.getText();
        //cantidadarreglo=this.jtf_canpzaingresa.getText();
        codigoi=this.jtf_idarticulo.getText();

        if (this.jtf_idarticulo.getText().length() >0) {
            if(JOptionPane.showConfirmDialog(null, "<html><b><h3>Articulo="+this.jtf_idarticulo.getText()+"</h3></b> Desea es Correcto?</html>")==0) {

                this.articulo_buscar(1, 1, codigoi);
            } else {
                this.jtf_idarticulo.requestFocus();
                this.jtf_idarticulo.selectAll();
            }
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar Precio y codigo", "Sistema Integral(Agregar Articulo) : Error",1);
        }
    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jtf_claveivActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_claveivActionPerformed
        // TODO add your handling code here:
this.clave_concatenar(1);
}//GEN-LAST:event_jtf_claveivActionPerformed

    private void jtf_clavetcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_clavetcActionPerformed
    this.clave_concatenar(1);
}//GEN-LAST:event_jtf_clavetcActionPerformed

    private void jcbx_familiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_familiaActionPerformed
        // TODO add your handling code here:
        if  (controlcargo>0)
        {
        this.clave_concatenar(4);
        }
}//GEN-LAST:event_jcbx_familiaActionPerformed

    private void jcbx_iddescricortaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_iddescricortaActionPerformed
        // TODO add your handling code here:
        if  (controlcargo>0)
        {
        this.clave_concatenar(5);

        }
}//GEN-LAST:event_jcbx_iddescricortaActionPerformed

    private void jcbx_clavemesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_clavemesActionPerformed
        // TODO add your handling code here:
        if  (controlcargo>0)
        {
        this.clave_concatenar(6);
        }
}//GEN-LAST:event_jcbx_clavemesActionPerformed

    private void jcbx_claveyearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_claveyearActionPerformed
        // TODO add your handling code here:
        if  (controlcargo>0)
        {
        this.clave_concatenar(7);
        }
}//GEN-LAST:event_jcbx_claveyearActionPerformed

    private void jtb_distribucionaltaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_distribucionaltaPropertyChange
        // TODO add your handling code here:
        this.calculardistribucion(1);
}//GEN-LAST:event_jtb_distribucionaltaPropertyChange

    private void jtb_distribucionaltaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_distribucionaltaKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jtb_distribucionaltaKeyPressed

    private void jbtn_agregardistribucionpreviaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregardistribucionpreviaActionPerformed
        // TODO add your handling code here:
        String tiendas[]=null;
        int elementos=this.jlst_clientesdistribucion.getModel().getSize();
        float cantidaddif=0,cantidad=0;
        while(jtable_modelo_detalledistri_ingresa.getRowCount()>0)jtable_modelo_detalledistri_ingresa.removeRow(0);
        System.out.println("disque estos son los elementos"+elementos);
          for(int j = 0 ;j < elementosmodelo ; j++)
                {
                    this.jlst_clientesdistribucion.setSelectedIndex(j);
                    tiendas=this.jlst_clientesdistribucion.getSelectedValue().toString().split(":");
                  if ((!tiendas[0].equals("09"))  && (!tiendas[0].equals("07")) && (!tiendas[0].equals("0")) && (!tiendas[0].equals("03")))
                    {
                        jtable_modelo_detalledistri_ingresa.addRow(new Object[]{tiendas[0],tiendas[1].trim().toUpperCase(),this.jtf_idarticulo.getText().toUpperCase().trim(),this.jtf_distripzxtie.getText().toString().trim()});
                        cantidad += Float.valueOf(this.jtf_distripzxtie.getText().toString()).floatValue();
                    }
                    if (tiendas[0].equals("09"))
                    {
                        jtable_modelo_detalledistri_ingresa.addRow(new Object[]{tiendas[0],tiendas[1].trim().toUpperCase(),this.jtf_idarticulo.getText().toUpperCase().trim(),this.jtf_distripzalma.getText().toString().trim()});
                        cantidad += Float.valueOf(this.jtf_distripzalma.getText().toString()).floatValue();
                    }
                    if (tiendas[0].equals("0"))
                    {
                        cantidaddif = Float.valueOf(this.jtf_distripzfal.getText().toString()).floatValue()+(Float.valueOf(this.jtf_distripzsob.getText().toString()).floatValue()*-1);
                        jtable_modelo_detalledistri_ingresa.addRow(new Object[]{tiendas[0],tiendas[1].trim().toUpperCase(),this.jtf_idarticulo.getText().toUpperCase().trim(),cantidaddif});
                    }
                    if (tiendas[0].equals("07"))
                    {
                        jtable_modelo_detalledistri_ingresa.addRow(new Object[]{tiendas[0],tiendas[1].trim().toUpperCase(),this.jtf_idarticulo.getText().toUpperCase().trim(),"0"});
                    }
                  }
            this.jtf_distripzfal.setText("0");
            this.jtf_distripzsob.setText("0");
            this.jtf_distritotalpz.setText(String.valueOf(cantidad));
            this.jbtn_agregapartidalocal.requestFocus();
}//GEN-LAST:event_jbtn_agregardistribucionpreviaActionPerformed

    private void jtf_clavecantidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_clavecantidadActionPerformed
        // TODO add your handling code here:
        this.jtf_distripzxtie.requestFocus();
    }//GEN-LAST:event_jtf_clavecantidadActionPerformed

    private void jtf_distripzxtieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_distripzxtieActionPerformed
        // TODO add your handling code here:
        this.jtf_distripzalma.requestFocus();
    }//GEN-LAST:event_jtf_distripzxtieActionPerformed

    private void jtf_distripzalmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_distripzalmaActionPerformed
        // TODO add your handling code here:
        this.jtf_distripzfal.requestFocus();
    }//GEN-LAST:event_jtf_distripzalmaActionPerformed

    private void jtf_distripzfalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_distripzfalActionPerformed
        // TODO add your handling code here:
        this.jtf_distripzsob.requestFocus();
    }//GEN-LAST:event_jtf_distripzfalActionPerformed

    private void jtf_distripzsobActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_distripzsobActionPerformed
        // TODO add your handling code here:
        this.jbtn_agregardistribucionprevia.requestFocus();
    }//GEN-LAST:event_jtf_distripzsobActionPerformed

    private void jtf_precioventaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_precioventaActionPerformed
        // TODO add your handling code here:
        this.jtf_clavecantidad.requestFocus();
    }//GEN-LAST:event_jtf_precioventaActionPerformed

    private void jtf_costoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_costoActionPerformed
        // TODO add your handling code here:
        this.jtf_precioventa.requestFocus();
    }//GEN-LAST:event_jtf_costoActionPerformed

    private void jmni_altaproveeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_altaproveeActionPerformed
        // TODO add your handling code here:
         JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
        com_distri_compras_proveedores_alta fcdcpe=new com_distri_compras_proveedores_alta(mainFrame,true);
        fcdcpe.setVisible(true);
    }//GEN-LAST:event_jmni_altaproveeActionPerformed

    private void jtf_viajeinicialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_viajeinicialActionPerformed
        // TODO add your handling code here:
                this.jtf_viajeobservaciones.requestFocus();
}//GEN-LAST:event_jtf_viajeinicialActionPerformed

    private void jtf_distritotalpzActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_distritotalpzActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_distritotalpzActionPerformed

    private void jtf_idfolioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_idfolioActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_idfolioActionPerformed

    private void jtb_distribucioncontrolinterno1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinterno1PropertyChange
        // TODO add your handling code here:
        this.calculardistribucion(2);
    }//GEN-LAST:event_jtb_distribucioncontrolinterno1PropertyChange

    private void jtb_distribucioncontrolinterno1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinterno1KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtb_distribucioncontrolinterno1KeyPressed

    private void jbtn_distribucionupdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_distribucionupdateActionPerformed
        // TODO add your handling code here:
        DecimalFormat miformat = new DecimalFormat("#########.##");
        int columnatienda=0,numerofilasd=this.jtable_modelo_detalledistri_intupdate.getRowCount(),ii=0;
        String codi="",codidetalle="";
        for( ii=0;ii<numerofilasd;ii++)
                        {
                            columnatienda=this.findcolumna_idtienda(jtable_modelo_detalledistri_intupdate.getValueAt(ii, 0).toString());
                            this.crea_hoja_distribucionalmacen(jtable_modelo_detalledistri_intupdate.getValueAt(ii, 1).toString(), jtable_modelo_detalledistri_intupdate.getValueAt(ii, 2).toString(), columnatienda,jtable_modelo_detalledistri_intupdate.getValueAt(ii, 0).toString());

                        }
        numerofilasd=this.jtable_modelo_detallecompra.getRowCount();
        for( ii=0;ii<numerofilasd;ii++)
                        {
                        codi=this.jtf_actualizadisclave.getText().toString().trim();
                        codidetalle=jtable_modelo_detallecompra.getValueAt(ii, 1).toString().trim();
                        if (codi.equals(codidetalle))
                            {
                                System.out.println("si es igual"+codi+" "+codidetalle);
                                jtable_modelo_detallecompra.setValueAt(miformat.format(Float.valueOf(this.jtf_piezasxparupdate.getText().toString())),ii ,7);
                            }
                        }
    }//GEN-LAST:event_jbtn_distribucionupdateActionPerformed

    private void jbtn_agregapartidalocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregapartidalocalActionPerformed
        // TODO add your handling code here:
        String arreglo_codigo[]=null,cadena="";
        String arreglo_idfam[]=this.jcbx_familia.getSelectedItem().toString().split(":");
        int numerofilasd=this.jtable_modelo_detalledistri_ingresa.getRowCount(),ii=0;
        int columnatienda=0;
        float cantidaddispre=0,cantidadparti=0;
        cantidaddispre = Float.valueOf(this.jtf_distritotalpz.getText().toString()).floatValue();
        cantidaddispre = Float.valueOf(this.jtf_clavecantidad.getText().toString()).floatValue();

        if ((this.jtf_idarticulo.getText().toString().length()>0) && (this.jtf_insumodescripcion.getText().toString().length()>2) && (this.jtf_clavedescor.getText().toString().length()>0) && (this.jtf_unidadsal.getText().toString().length()>0))
            {
                    for( ii=0;ii<numerofilasd;ii++)
                        {
                            columnatienda=this.findcolumna_idtienda(jtable_modelo_detalledistri_ingresa.getValueAt(ii, 0).toString());
                            cadena=this.jtf_idarticulo.getText()+":"+this.jtf_insumodescripcion.getText()+":"+this.jtf_clavedescor.getText()+":"+this.jtf_itemprov.getText()+":"+this.jtf_itemderi.getText()+":"+this.jtf_unidadsal.getText()+":"+this.jtf_costo.getText()+":"+this.jtf_precioventa.getText()+":"+arreglo_idfam[0]+":"+jtable_modelo_detalledistri_ingresa.getValueAt(ii, 3).toString()+"";
                            arreglo_codigo=cadena.split(":");
                            this.crea_hoja_distribucionalmacen(arreglo_codigo, jtable_modelo_detalledistri_ingresa.getValueAt(ii, 0).toString(), columnatienda);
                        }
                     while(jtable_modelo_detalledistri_ingresa.getRowCount()>0)jtable_modelo_detalledistri_ingresa.removeRow(0);
                    //this.carga_datos_claveterminacion(1,this.jtf_idproveedor.getText().toUpperCase());
                    indicetermina+=1;
                    jtable_modelo_terminaciones.setValueAt(this.jtf_idarticulo.getText().trim().toUpperCase(),indicetermina ,2);
                    this.jtf_clavetc.setText(jtable_modelo_terminaciones.getValueAt(indicetermina+1, 1).toString());
                    this.clave_concatenar(1);
                    hayregistros=1;
            }
        else
            {
                JOptionPane.showMessageDialog(null,"Favor de Verificar los campos antes de Agregar el Articulo", "Sistema Integral(Agregar Articulo) : Error",1);
                this.jtf_idarticulo.requestFocus();
            }
}//GEN-LAST:event_jbtn_agregapartidalocalActionPerformed

    private void jtb_distribucioncontrolinterno2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinterno2PropertyChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jtb_distribucioncontrolinterno2PropertyChange

    private void jtb_distribucioncontrolinterno2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtb_distribucioncontrolinterno2KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtb_distribucioncontrolinterno2KeyPressed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        this.carga_datos_claveterminacionlocal(1,"");
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jmni_salirsinguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirsinguardarActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jmni_salirsinguardarActionPerformed

    private void jbtn_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_actualizarActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos los Datos?")==0)
        {
         int folio=0;
         String textosql="select * from x1distribucion_terminados_entra_doctos_update(1,'"+this.jtf_idfolio.getText()+"','"+this.jtf_observa_update.getText().toUpperCase().trim()+"','');";
         try {
            rs = x.sieuno_executediversosv2(textosql,variables_global.getconexiongral());
            while (rs.next())
                {
                folio = rs.getInt(1);
                }
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
         if (folio==1)
                      {
                        this.jep_observaciones.setText(this.jtf_observa_update.getText().toUpperCase().trim());
                        JOptionPane.showMessageDialog(null,"Gracias Observacion Actualizada correctamente", "Sistema Integral: Entrada",1);
                      }
                else
                      {
                        JOptionPane.showMessageDialog(null,"Error Verifiqu con Administrador no se ha podido guardar", "Sistema Integral Error",1);
                      }
        }
}//GEN-LAST:event_jbtn_actualizarActionPerformed

    private void jtf_fleteygastosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fleteygastosActionPerformed
        // TODO add your handling code here:
  this.calcular_costoi();
  this.calcularimportes();
                
}//GEN-LAST:event_jtf_fleteygastosActionPerformed

    private void jtf_fleteygastosporActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fleteygastosporActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtf_fleteygastosporActionPerformed

    private void jbtn_cargardistribucionxclieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_cargardistribucionxclieActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Ver Distribucion x Cliente?")==0) {
            this.carga_datos_distribucionxclie(this.jtf_idfolio.getText());
        }
    }//GEN-LAST:event_jbtn_cargardistribucionxclieActionPerformed

    private void jbtn_generarventaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_generarventaActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Generar la Venta al Cliente?")==0) {
            String idprov[]=this.jtf_idproveedor.getText().toString().split(":");
            int retorno=0;
            String texto="select * from x1distribucion_terminados_ventas_agregar(1,'"+this.jtf_idfolio.getText()+"','1','"+this.jtf_idcliente.getText()+"','"+idprov[0]+"');";
            System.out.println(texto);
            try {
                rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                while (rs.next()) {
                    retorno=rs.getInt(1);
                }
            } catch(Exception e) {
                System.out.println(e.getMessage());
            }
            if (retorno>0) {
                this.jbtn_generarventa.setVisible(false);
                jtable_modelo.setValueAt(retorno,Integer.valueOf(this.jtf_idffila.getText()) ,0);
                JOptionPane.showMessageDialog(null," Folio "+retorno+" Correcto", "Sistema Integral(Venta Alta) : Error",1);
            }
        }
    }//GEN-LAST:event_jbtn_generarventaActionPerformed

    private void jbtn_generarventa1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_generarventa1ActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Generar Venta y Recepcionar?")==0) {
            String idprov[]=this.jtf_idproveedor.getText().toString().split(":");
            int retorno=0;
            String texto="select * from x1distribucion_terminados_ventas_agregar(1,'"+this.jtf_idfolio.getText()+"','1','"+this.jtf_idcliente.getText()+"','"+idprov[0]+"');";
            System.out.println(texto);
            try {
                rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                while (rs.next()) {
                    retorno=rs.getInt(1);
                }
            } catch(Exception e) {
                System.out.println(e.getMessage());
            }
            if (retorno>0) {
                this.jbtn_generarventa.setVisible(false);
                jtable_modelo.setValueAt(retorno,Integer.valueOf(this.jtf_idffila.getText()) ,0);
                JOptionPane.showMessageDialog(null," Folio "+retorno+" Correcto", "Sistema Integral(Venta Alta) : Error",1);


                try {
                    rs = x.sieuno_executediversosv2("select * from x1distribucion_ventas_add_sieuno('"+ retorno+"') as (status smallint)",variables_global.getconexiongral());
                    while (rs.next()) {
                        if (Integer.valueOf(rs.getString(1)) < 3) {
                            JOptionPane.showMessageDialog(null," Recepcion Correcta, Gracias", "Sistema Integral(Detalle Recepcion) : Confirmacion",1);
                        } else {
                            JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Detalle Recepcion) : Error",1);
                        }
                    }

                } catch(Exception e) {
                    System.out.println(e.getMessage());
                    JOptionPane.showMessageDialog(null," Recepcion Incorrecta ", "Sistema Integral(Detalle Recepcion) : Error",1);
                }
            }


        }


    }//GEN-LAST:event_jbtn_generarventa1ActionPerformed

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
          indexactual=this.jTabbedPane1.getSelectedIndex();
        if((indexactual==5)&&(yacarguedistrirecepciones==0))
            {
               yacarguedistrirecepciones=1;
               this.carga_datos(7,this.jtf_idfolio.getText().trim());
            }
    }//GEN-LAST:event_jTabbedPane1StateChanged

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
yacarguedistrirecepciones=0;
  if((indexactual==5)&&(yacarguedistrirecepciones==0))
            {
               yacarguedistrirecepciones=1;
               this.carga_datos(7,this.jtf_idfolio.getText().trim());
            }
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jbtn_importar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importar1ActionPerformed
        // TODO add your handling code here:
               if(JOptionPane.showConfirmDialog(null, "<html><body>Desea Actualizar Costo</b></body></html>")==0)
                    {
                     String idclientearre[]=this.jtf_tiendaactual.getText().split(":");
                        String arreglo_importa[]=this.jta_archivo.getText().split("\n");
                        String arreglo_codigo[]=null;
                        System.out.println("Estos tiene archivo:"+arreglo_importa.length);
                        int columnatienda=this.findcolumna_idtienda(idclientearre[0]);
                        for (int i=0;i<arreglo_importa.length;i++)
                            {
                                arreglo_codigo=arreglo_importa[i].split("\t");
                                this.crea_hoja_actualizacosto(arreglo_codigo[0], arreglo_codigo[1], 0);
                            }
     this.contruir_totales_distribucionalma();
     this.calcularimportes();
     hayregistros=1;
     this.jta_archivo.setText("");
    }
    }//GEN-LAST:event_jbtn_importar1ActionPerformed

    private void jbtn_importar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importar2ActionPerformed
        // TODO add your handling code here:
if(JOptionPane.showConfirmDialog(null, "<html><body>Desea Importar Estos Articulos a tienda:<br><b><h2>"+this.jtf_tiendaactual.getText()+"?</h2></b></body></html>")==0)
    {
        if (sihaytotal==1)
            {
                this.jtable_modelo_detalledistribucion.removeRow(jtable_modelo_detalledistribucion.getRowCount()-1);
            }
            String idclientearre[]=this.jtf_tiendaactual.getText().split(":");
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            int columnatienda=this.findcolumna_idtienda(idclientearre[0]);
             for (int i=0;i<arreglo_importa.length;i++)
             {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.crea_hoja_distribucionalmacen_mas(arreglo_codigo, idclientearre[0], columnatienda);
                //this.jtf_anchomaterial.setText(arreglo_codigo[0]);
                //this.jtf_idinsumo.setText(arreglo_codigo[1]);
                //this.jtf_canpzaingresa.setText(arreglo_codigo[2]);
                //this.jtf_pzasreferencia.setText(arreglo_codigo[3]);
                //this.jtf_segundos.setText(arreglo_codigo[4]);
                //this.jtf_precioinsimo.setText(arreglo_codigo[5]);
                //this.calcularcortexpieza();
                //this.jbtn_buscarActionPerformed(evt);

            }
            this.jbtn_importar.setVisible(false);
            this.jbtn_agregar.setVisible(false);
            this.jbtn_guardar.setVisible(false);
            this.jbtn_agregar1.setVisible(false);
     this.contruir_totales_distribucionalma();
     this.calcularimportes();
     hayregistros=1;
     this.jta_archivo.setText("");
            //this.jtf_canpzaingresa.setText("0");
            //this.jtf_idinsumo.setText("");
            //this.jtf_idinsumo.requestFocus();

        }
    }//GEN-LAST:event_jbtn_importar2ActionPerformed

    private void jbtn_agregar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregar1ActionPerformed
        // TODO add your handling code here:
       float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
       int folios=0;
       String arreglo_viaje[]=this.jcmbx_clasifviaje.getSelectedItem().toString().split(":"),folio="";
       if ((Integer.valueOf(arreglo_viaje[0])>0)  && (controlpro==1) && (tpiezas>0))
                {
                    this.documento_guardar(2,2);
                    //this.carga_datos_claveterminacion(3, this.jtf_idproveedor.getText(),this.jtf_clavetc.getText());
                    //hayregistros=0;
                    //System.out.println("se guarda");
                    folios=Integer.valueOf(this.jtf_idfolio.getText())+1;
                    folio=String.valueOf(folios);
                    if(JOptionPane.showConfirmDialog(null, "<html><h2>Desea ver Folio:"+folio+"?</h2></html>")==0)
                        {

                            this.carga_datos_encabezado(11, folio);
                            this.carga_datos_detalle(folio);
                            this.carga_datos_distribucionalma(folio);
                            this.carga_datos_proveedor(1, this.jtf_idproveedor.getText().toUpperCase().trim());
                            this.contruir_totales_distribucionalma();
                        }
                    else
                    {
                        this.dispose();
                    }
                }
            else
                {
                    JOptionPane.showMessageDialog(null,"Favor de Verificar Viaje,Proveedor etc", "Sistema Integral(Agregar Produccion) : Error",1);
                }
    }//GEN-LAST:event_jbtn_agregar1ActionPerformed

    private void jmni_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_guardarActionPerformed
        // TODO add your handling code here:
        this.jbtn_guardarActionPerformed(evt);
    }//GEN-LAST:event_jmni_guardarActionPerformed

    private void jbtn_eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_eliminarActionPerformed
        // TODO add your handling code here:
         String texto="select * from x1distribucion_terminados_entra_doctos_delete(1,'"+this.jtf_idfolio.getText().toString()+"','','');",folio=this.jtf_idfolio.getText().toString(),jtfolio="";
         jtfolio=JOptionPane.showInputDialog("Ingresa Folio a Eliminar:");
         if(jtfolio.equals(folio))
           {
         if(JOptionPane.showConfirmDialog(null,"<html><h2><b>Documento a Eliminar?<br>Folio:"+this.jtf_idfolio.getText().toString()+" Estan correcto sus Datos</b></h2></html>")==0)
            {
                    //           this.quitardescripcion();

                    System.out.println(texto);

                    try {
                        rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
                        while (rs.next())
                            {

                            if (rs.getInt(1) > 0)
                                {
                                    JOptionPane.showMessageDialog(null,"Documento Eliminado, Gracias", "Sistema Integral(Entrada Insumos) : Confirmacion",1);
                                    this.dispose();
                                }
                            else
                                {
                                    JOptionPane.showMessageDialog(null," Error Verifique su Documento", "Sistema Integral(Entrada Insumos) : Error",1);
                                }
                            }
                        }
                        catch(Exception e)
                            {
                                System.out.println(e.getMessage());
                                JOptionPane.showMessageDialog(null," Operacion Incorrecta ", "Sistema Integral(Entrada Insumos) : Error",1);
                            }
                    //this.btn_guardar.setVisible(false);
            }//fin del if qu confirmo guardar diferencia
         }//fin del if que evalua si los folios coinciden
         else
            {
                JOptionPane.showMessageDialog(null," Error Verifique su folio", "Sistema Integral(requisicion Insumos) : Error",1);
            }
}//GEN-LAST:event_jbtn_eliminarActionPerformed

    private void jtf_fleteygastos1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_fleteygastos1ActionPerformed
        // TODO add your handling code here:

    }//GEN-LAST:event_jtf_fleteygastos1ActionPerformed

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
        // TODO add your handling code here:
 
    }//GEN-LAST:event_jMenu2ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
               float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
       // int index=this.jcmbx_tiendaclie.getSelectedIndex();
        int indexope=this.jcmbx_clasifviaje.getSelectedIndex();
        if ((indexope>0)  && (controlpro==1) && (tpiezas>0)) {
            this.documento_guardar_mas(1);

            hayregistros=0;
            System.out.println("se guarda");
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar Viaje,Proveedor etc", "Sistema Integral(Agregar Produccion) : Error",1);
        }
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jbtn_agregar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregar2ActionPerformed
        // TODO add your handling code here:
                       float tpiezas=Float.valueOf(this.jtf_cantidadpiezas.getText().trim());
       // int index=this.jcmbx_tiendaclie.getSelectedIndex();
        int indexope=this.jcmbx_clasifviaje.getSelectedIndex();
        if ((indexope>0)  && (controlpro==1) && (tpiezas>0)) {
            this.documento_guardar_mas(1);
            hayregistros=0;
            this.dispose();
            System.out.println("se guarda");
        } else {
            JOptionPane.showMessageDialog(null,"Favor de Verificar Viaje,Proveedor etc", "Sistema Integral(Agregar Produccion) : Error",1);
        }
    }//GEN-LAST:event_jbtn_agregar2ActionPerformed

    private void jbtn_importar3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_importar3ActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "<html><body>Desea Importar Estos Articulos a tienda:<br><b><h2>"+this.jtf_tiendaactual.getText()+"?</h2></b></body></html>")==0)
    {
        if (sihaytotal==1)
            {
                 this.jtable_modelo_detalledistribucion.removeRow(jtable_modelo_detalledistribucion.getRowCount()-1);
            }
            String idclientearre[]=this.jtf_tiendaactual.getText().split(":");
            String arreglo_importa[]=this.jta_archivo.getText().split("\n");
            String arreglo_codigo[]=null;
            System.out.println("Estos tiene archivo:"+arreglo_importa.length);
            int columnatienda=this.findcolumna_idtienda(idclientearre[0]);
             for (int i=0;i<arreglo_importa.length;i++)
             {
                arreglo_codigo=arreglo_importa[i].split("\t");
                this.crea_hoja_distribucionalmacen_massd(arreglo_codigo, idclientearre[0], columnatienda);
                //this.jtf_anchomaterial.setText(arreglo_codigo[0]);
                //this.jtf_idinsumo.setText(arreglo_codigo[1]);
                //this.jtf_canpzaingresa.setText(arreglo_codigo[2]);
                //this.jtf_pzasreferencia.setText(arreglo_codigo[3]);
                //this.jtf_segundos.setText(arreglo_codigo[4]);
                //this.jtf_precioinsimo.setText(arreglo_codigo[5]);
                //this.calcularcortexpieza();
                //this.jbtn_buscarActionPerformed(evt);

            }
            this.jbtn_importar.setVisible(false);
            this.jbtn_agregar.setVisible(false);
            this.jbtn_guardar.setVisible(false);
            this.jbtn_agregar1.setVisible(false);
     this.contruir_totales_distribucionalma();
     this.calcularimportes();
     hayregistros=1;
     this.jta_archivo.setText("");
            //this.jtf_canpzaingresa.setText("0");
            //this.jtf_idinsumo.setText("");
            //this.jtf_idinsumo.requestFocus();

        }
    }//GEN-LAST:event_jbtn_importar3ActionPerformed
  private void jtb_distribucionMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    private void jlst_clientesdistribucionMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    private void jtbl_recepcionesMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new com_distri_compras_alta().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_actualizar;
    private javax.swing.JButton jbtn_agregapartidalocal;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_agregar1;
    private javax.swing.JButton jbtn_agregar2;
    private javax.swing.JButton jbtn_agregardistribucionprevia;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JButton jbtn_cargardistribucionxclie;
    private javax.swing.JButton jbtn_crearviaje;
    private javax.swing.JButton jbtn_distribucionupdate;
    private javax.swing.JButton jbtn_eliminar;
    private javax.swing.JButton jbtn_generarventa;
    private javax.swing.JButton jbtn_generarventa1;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_helpayudame;
    private javax.swing.JButton jbtn_importar;
    private javax.swing.JButton jbtn_importar1;
    private javax.swing.JButton jbtn_importar2;
    private javax.swing.JButton jbtn_importar3;
    private javax.swing.JButton jbtn_salir;
    private javax.swing.JComboBox jcbx_clavemes;
    private javax.swing.JComboBox jcbx_claveyear;
    private javax.swing.JComboBox jcbx_familia;
    private javax.swing.JComboBox jcbx_iddescricorta;
    private javax.swing.JCheckBoxMenuItem jckbx_redondear;
    private javax.swing.JCheckBoxMenuItem jckbx_simularred;
    private javax.swing.JComboBox jcmbx_clasifviaje;
    private com.toedter.calendar.JDateChooser jdc_fechadocto;
    private com.toedter.calendar.JDateChooser jdc_fecharecepcion;
    private com.toedter.calendar.JDateChooser jdc_fecharef;
    private javax.swing.JTextField jep_observaciones;
    private javax.swing.JLabel jlbl_costo2;
    private javax.swing.JLabel jlbl_costo3;
    private javax.swing.JList jlst_clientesdistribucion;
    private javax.swing.JMenuItem jmni_altaprovee;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_guardar;
    private javax.swing.JMenuItem jmni_limpiardocto;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JMenuItem jmni_salirsinguardar;
    private javax.swing.JPanel jpn_cuerpo;
    private javax.swing.JTextArea jta_archivo;
    private javax.swing.JTable jtb_distribucion;
    private javax.swing.JTable jtb_distribucionalta;
    private javax.swing.JTable jtb_distribucioncontrolinterno;
    private javax.swing.JTable jtb_distribucioncontrolinterno1;
    private javax.swing.JTable jtb_distribucioncontrolinterno2;
    private javax.swing.JTable jtb_terminadosentrada;
    private javax.swing.JTable jtbl_recepciones;
    private javax.swing.JTextField jtf_actualizadisclave;
    private javax.swing.JTextField jtf_cantidadpiezas;
    private javax.swing.JTextField jtf_cantidadpiezas1;
    private javax.swing.JTextField jtf_cantidadpiezas2;
    private javax.swing.JTextField jtf_clavecantidad;
    private javax.swing.JTextField jtf_clavedescor;
    private javax.swing.JTextField jtf_claveiv;
    private javax.swing.JTextField jtf_clavetc;
    private javax.swing.JTextField jtf_contruirinip;
    private javax.swing.JTextField jtf_costo;
    private javax.swing.JTextField jtf_describecliente;
    private javax.swing.JTextField jtf_describeproveedor;
    private javax.swing.JTextField jtf_descuento;
    private javax.swing.JTextField jtf_distripzalma;
    private javax.swing.JTextField jtf_distripzfal;
    private javax.swing.JTextField jtf_distripzsob;
    private javax.swing.JTextField jtf_distripzxtie;
    private javax.swing.JTextField jtf_distritotalpz;
    private javax.swing.JTextField jtf_doctodesc;
    private javax.swing.JTextField jtf_doctodesc1;
    private javax.swing.JTextField jtf_doctoimp;
    private javax.swing.JTextField jtf_doctoimp1;
    private javax.swing.JTextField jtf_doctosubtotal;
    private javax.swing.JTextField jtf_doctosubtotal1;
    private javax.swing.JTextField jtf_doctototal;
    private javax.swing.JTextField jtf_doctototal1;
    private javax.swing.JTextField jtf_fleteygastos;
    private javax.swing.JTextField jtf_fleteygastos1;
    private javax.swing.JTextField jtf_fleteygastospor;
    private javax.swing.JTextField jtf_idarticulo;
    private javax.swing.JTextField jtf_idcliente;
    private javax.swing.JTextField jtf_idffila;
    private javax.swing.JTextField jtf_idfolio;
    private javax.swing.JTextField jtf_idproveedor;
    private javax.swing.JTextField jtf_impuesto;
    private javax.swing.JTextField jtf_insumodescripcion;
    private javax.swing.JTextField jtf_itemderi;
    private javax.swing.JTextField jtf_itemprov;
    private javax.swing.JTextField jtf_observa_update;
    private javax.swing.JTextField jtf_piezasxparupdate;
    private javax.swing.JTextField jtf_precioventa;
    private javax.swing.JTextField jtf_pzasdistri;
    private javax.swing.JTextField jtf_tiendaactual;
    private javax.swing.JTextField jtf_totalcostov;
    private javax.swing.JTextField jtf_totalpreciopublic;
    private javax.swing.JTextField jtf_unidadsal;
    private javax.swing.JTextField jtf_viajedescribe;
    private javax.swing.JTextField jtf_viajeinicial;
    private javax.swing.JTextField jtf_viajeobservaciones;
    private javax.swing.JTextField tf_foliodoctoanterior;
    // End of variables declaration//GEN-END:variables

}
